AniwaffleDocsHomeStudio

Get started

Authentication

Authenticate server requests with a workspace API key. Browser and mobile clients use short-lived stream tokens that your server creates.

API keys

Every request sends a workspace API key as a bearer token:

http
Authorization: Bearer awp_...

A key belongs to one workspace. It can use every voice in that workspace, and its usage is billed to that workspace's credit balance.

Create a key

  1. In Studio, open API keys. Creating keys requires the Owner, Admin or Builder role.
  2. Select Create API key, enter a Name such as production-server, and select Create key.
  3. Copy the key from the Save your key dialog. The full key is shown only once. If you lose it, create a new key and revoke the old one.

You can also create a key from the terminal with aniwaffle keys create -f label='production-server'. See CLI.

Use a key

curl https://aniwaffle.com/v1/voices \
  --header "Authorization: Bearer $ANIWAFFLE_API_KEY"

Keep keys in your server's secret manager. Never put a key in browser code, a mobile app, a repository or a log.

Revoke a key

Select Revoke next to the key in API keys. New HTTP requests and new WebSocket connections with that key are rejected immediately. A WebSocket connection that was already open can finish its current request.

Stream tokens for client apps

To stream speech directly to a browser or mobile app, have your server create a stream token and pass only the token to the client. A stream token:

  • opens connections to the streaming endpoint only,
  • expires 2 minutes after it is created,
  • never exposes your API key.

Create one token per connection.

// Your backend: create a token with the API key.
const response = await fetch('https://aniwaffle.com/v1/tts/stream-tokens', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.ANIWAFFLE_API_KEY}` },
})
const { token, websocket_url } = await response.json()
// Return { token, websocket_url } to your client.

Note: Browser connections are also checked against your workspace's allowed web origins. Email hello@narya.ai with the origins you use (for example https://app.example.com) before you ship a browser client.

See Create a stream token for the full request and response.

Roles and permissions

Studio, the API and the CLI apply the same workspace roles.

RoleAPI keysVoicesGenerate speech
Owner, Admin, BuilderCreate and revokeClone, edit and deleteYes
ReviewerNoBrowseYes

The products a workspace can use are set by its invitation. A request for a product the workspace does not have returns 403 with the code capability_disabled.

Authentication errors

CodeHTTP statusCause
unauthorized401The key is missing, malformed or revoked. On the streaming endpoint, the WebSocket handshake is rejected with 401.
capability_disabled403Text to Speech is not enabled for this workspace.
organization_suspended403The workspace is suspended. Contact us.

See Errors for every error code.

Contact our team

Tell us about your character and what you’d like to build.