Added API validation

Fixes #1