Limits and errors
Audio upload takes up to 25 MB of 16-bit, 16 kHz mono audio, a little over 13 minutes, and image upload takes JPEG images of up to 2 MB each, up to 25 MB in all. Realtime sessions take up to 1 second of audio per second or 3 video frames per second, and each organization can make up to 600 requests per minute. Each limit table names the error a request, frame, or message outside that limit returns. The upload and run endpoints return errors as HTTP responses, and realtime sessions send them as error messages, each with a stable code to handle in your application and a message for logs and debugging.
Audio
Both audio endpoints share these limits. Audio upload and Audio realtime explain them.
Audio upload
Audio realtime
Video
Both video endpoints share these limits. Image upload and Video realtime explain them.
Image upload
Video realtime
Runs
Rate limits
The limit counts requests to every Expression Measurement endpoint over a sliding 60-second window: audio and image uploads, realtime handshakes and run requests alike. Every API key in an organization shares it. Frames sent within a realtime session do not count toward it; the session’s send rate limits them instead: 1 second of audio per second for audio and 3 frames per second for video. A 429 carries a Retry-After header with the number of seconds to wait before retrying. See Handling errors.
There is no separate limit on how many uploads or realtime sessions an organization runs at once. When the service is at capacity, an upload is refused with 503 server_busy and a Retry-After header.
Scores and sessions
- Score arrays vary in length. A name that scores too low is left out of the array. See Reading probabilities.
- Realtime sessions close after 30 seconds without a usable media frame. See Connection behavior.
HTTP errors
The audio upload, image upload and run endpoints return an error as a JSON body with a 4xx or 5xx status. The status says how the request failed, and code says why.
Each of these endpoints also documents its errors in its own guide: audio upload errors, image upload errors and run errors.
Response format
Always error.
A stable string to branch on. See HTTP codes.
A description for logs and debugging. The wording may change without notice.
Identifies the request in Hume’s records. Quote it when contacting support.
Gateway errors
Hume’s API gateway answers two errors before the request reaches the service: a 401 for a missing or invalid credential and a 429 for a rate limit. Their body has a message but no type or code, so branch on the status for these. It carries a request_id only for a 401 whose API key was rejected. See Authentication and Rate limits.
HTTP codes
Handling errors
Realtime errors
A realtime session reports a problem as an error message. After a recoverable error, the session continues. After an unrecoverable error, it sends session.closed and closes the connection.
Codes that only one endpoint sends are documented in that endpoint’s guide: audio errors and video errors.
Message format
Always error.
A stable string to branch on.
A description for logs and debugging. The wording may change without notice.
false for every error that ends the session, and true for every error the session survives. The exception is internal_error on the video endpoint, where it says whether the failure was temporary and the frame is worth resending.
On the audio endpoint, the server replies only to a rejected frame, with an error. On the video endpoint, it replies to every frame, and Matching results to frames explains how to pair each reply with the frame it answers.
Shared codes
When an error ends the session, the error is followed by session.closed with reason set to error, and the connection closes with code 1008. Open a new connection to start another session.
The problems a session reports, such as rejected frames and failed measurements, are also recorded in its event log. Getting events describes the endpoint that returns the log and every kind of event in it.
Close codes
When the server ends a session, it closes the WebSocket with one of these codes. The code shows whether session.closed was sent first. Close frames carry a code and no reason text, so the reason is in session.closed. Closing lists the code for each reason.
Handshake failures
A handshake with a missing or invalid credential is rejected with 401 Unauthorized, a handshake from an organization that is not permitted to use the endpoint is rejected with 403 Forbidden, and a handshake over the organization’s rate limit is rejected with 429 Too Many Requests. All three are rejected before a WebSocket exists, so no error message can be sent; read the status from your client library’s handshake result. See Authentication.
Connection failures
If the server cannot continue a session, it closes the connection with code 1011 without sending session.closed. Treat a close that was not preceded by session.closed as a lost session and open a new connection.
- If the connection drops without a close frame, the session has ended. Client libraries report this as close code 1006. Open a new connection.
- A text message that is not valid UTF-8 ends the session with 1011.
Reporting a problem
When contacting support, include the identifier of the request or session:
- For an upload or run request, the
request_idfrom the response or the error body. - For a realtime session, the
session_idfromsession.created.