Base URL
Authentication
Send an API key in theAuthorization header of every request, after the word Token:
Authorization: Bearer is refused with 401. Create keys in the dashboard: a secret key (sk_) for your server, which can use every endpoint its scopes allow (managing API keys needs a full-access key), or a public key (pk_) for a website or app, which can only get call tokens (anything else with a public key is refused with 403). See API keys for the kinds of keys, scopes, call tokens and which key works where.
Your project
A key belongs to one project, and every request it makes acts on that project. Don’t sendprojectId in request bodies: Hamsa adds it from the key. A few endpoints need projectId in the query; their pages say so. It must be the key’s own project: a projectId for another project, in the query or the body, is refused with 403. To find it, see Copy a project ID.
Responses
A successful request answers with this shape:data holds the result; each endpoint’s page shows it. messageKey is a stable key you can match on in code. It isn’t sent by every endpoint.
Media links
Links to media that Hamsa returns, such as call recordings, generated audio and voice previews, are signed and work for 1 hour. Download the file when you get the link, or request the item again for a new link.Errors
A refused request answers with an HTTP error status and this shape:messageKey and params aren’t sent with every error, and params only carries details for some errors (for example the missing scope). Match on the HTTP status and messageKey. Some refusals, such as an invalid key, come back with the generic messageKey SomeThingWentWrong: for those, the status and message say what went wrong.
The refusals specific to API keys and call tokens are listed in When a request is refused.