> This page is for Expression Measurement.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://dev.hume.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://dev.hume.ai/_mcp/server.

# Limits and errors

> The limits of each Hume Expression Measurement endpoint, the error a request or frame outside each one returns, and the error formats and codes of the upload, run, and realtime endpoints.

**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](/expression-measurement/docs/audio/upload) and [Audio realtime](/expression-measurement/docs/audio/realtime) explain them.

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Audio format
      </td>

      <td>
        16-bit PCM, 16 kHz, mono
      </td>

      <td>
        `audio_decode_failed`

         on upload, 

        `config_invalid`

         in 

        `session.update`
      </td>
    </tr>

    <tr>
      <td>
        Measurement interval
      </td>

      <td>
        3000 to 10000 ms of speech, default 3000
      </td>

      <td>
        `config_invalid`
      </td>
    </tr>

    <tr>
      <td>
        Measurement window
      </td>

      <td>
        Up to the most recent 10 seconds of the utterance
      </td>

      <td>
        No error. Earlier speech is in earlier measurements.
      </td>
    </tr>
  </tbody>
</table>

### Audio upload

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [Container](/expression-measurement/docs/audio/upload#audio-format-and-size)
      </td>

      <td>
        A WAV file or headerless samples
      </td>

      <td>
        `unsupported_media_type`
      </td>
    </tr>

    <tr>
      <td>
        [Request size](/expression-measurement/docs/audio/upload#audio-format-and-size)
      </td>

      <td>
        25 MB, a little over 13 minutes of audio
      </td>

      <td>
        `audio_too_long`
      </td>
    </tr>
  </tbody>
</table>

### Audio realtime

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [Audio frame](/expression-measurement/docs/audio/realtime#audio-format)
      </td>

      <td>
        Up to 320 KB (10 seconds) of whole headerless samples
      </td>

      <td>
        `invalid_audio_frame`
      </td>
    </tr>

    <tr>
      <td>
        [Message size](/expression-measurement/docs/audio/realtime#audio-format)
      </td>

      <td>
        1 MiB (1,048,576 bytes) for any WebSocket message
      </td>

      <td>
        `message_too_large`

        , which ends the session
      </td>
    </tr>

    <tr>
      <td>
        [Send rate](/expression-measurement/docs/audio/realtime#send-rate)
      </td>

      <td>
        1 second of audio per second
      </td>

      <td>
        `rate_limited`
      </td>
    </tr>
  </tbody>
</table>

## Video

Both video endpoints share these limits. [Image upload](/expression-measurement/docs/video/upload) and [Video realtime](/expression-measurement/docs/video/realtime) explain them.

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Image format
      </td>

      <td>
        JPEG
      </td>

      <td>
        `unsupported_media_type`

         on upload, 

        `invalid_image_frame`

         in realtime
      </td>
    </tr>

    <tr>
      <td>
        Pixels per image
      </td>

      <td>
        8,294,400 (3840x2160)
      </td>

      <td>
        `image_too_large`

         on upload, 

        `invalid_image_frame`

         in realtime
      </td>
    </tr>

    <tr>
      <td>
        Faces measured per image
      </td>

      <td>
        2 by default, the largest. Contact support to raise it.
      </td>

      <td>
        No error. Other faces are listed without scores.
      </td>
    </tr>

    <tr>
      <td>
        Faces listed per image
      </td>

      <td>
        32
      </td>

      <td>
        No error. The least confident faces past 32 are left out.
      </td>
    </tr>

    <tr>
      <td>
        Detection threshold
      </td>

      <td>
        0 to 1, default 0.9
      </td>

      <td>
        `config_invalid`
      </td>
    </tr>

    <tr>
      <td>
        Minimum face size
      </td>

      <td>
        At least 1 pixel, default 60
      </td>

      <td>
        `config_invalid`
      </td>
    </tr>
  </tbody>
</table>

### Image upload

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [Image size](/expression-measurement/docs/video/upload#images)
      </td>

      <td>
        2 MB
      </td>

      <td>
        `image_too_large`
      </td>
    </tr>

    <tr>
      <td>
        [Request size](/expression-measurement/docs/video/upload#images)
      </td>

      <td>
        25 MB for the whole multipart body
      </td>

      <td>
        `image_too_large`
      </td>
    </tr>
  </tbody>
</table>

### Video realtime

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [Message size](/expression-measurement/docs/video/realtime#frames)
      </td>

      <td>
        2 MB for any WebSocket message
      </td>

      <td>
        `message_too_large`

        , which ends the session
      </td>
    </tr>

    <tr>
      <td>
        [Send rate](/expression-measurement/docs/video/realtime#send-rate)
      </td>

      <td>
        3 frames per second
      </td>

      <td>
        `rate_limited`
      </td>
    </tr>

    <tr>
      <td>
        [Consecutive measurement failures](/expression-measurement/docs/video/realtime#errors)
      </td>

      <td>
        5
      </td>

      <td>
        `internal_error`

         on the fifth, which ends the session
      </td>
    </tr>
  </tbody>
</table>

## Runs

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [Page size](/expression-measurement/docs/runs#pagination)
      </td>

      <td>
        1 to 200 runs or events per page, default 50
      </td>

      <td>
        `invalid_request`
      </td>
    </tr>
  </tbody>
</table>

## Rate limits

<table>
  <thead>
    <tr>
      <th width="25%">
        Limit
      </th>

      <th>
        Value
      </th>

      <th width="30%">
        Outside the limit
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Requests
      </td>

      <td>
        600 per minute per organization
      </td>

      <td>
        `429 Too Many Requests`
      </td>
    </tr>
  </tbody>
</table>

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](#audio-realtime) and 3 frames per second for [video](#video-realtime). A `429` carries a `Retry-After` header with the number of seconds to wait before retrying. See [Handling errors](#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

1. **Score arrays vary in length.** A name that scores too low is left out of the array. See [Reading probabilities](/expression-measurement/docs/scores#reading-probabilities).
2. **Realtime sessions close after 30 seconds without a usable media frame.** See [Connection behavior](/expression-measurement/docs/sessions#connection-behavior).

## HTTP errors

The [audio upload](/expression-measurement/docs/audio/upload), [image upload](/expression-measurement/docs/video/upload) and [run](/expression-measurement/docs/runs) 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](/expression-measurement/docs/audio/upload#errors), [image upload errors](/expression-measurement/docs/video/upload#errors) and [run errors](/expression-measurement/docs/runs#errors).

### Response format

#### 400 Bad Request

```json
{
  "type": "error",
  "code": "config_invalid",
  "message": "the config part is not valid: unknown field `timer_ms`, expected `measurement_timer_ms` at line 1 column 11",
  "request_id": "3f9a1c07e2b84d56a0c7e19b5d2f8a64"
}
```

**`type`**

Always `error`.

---

**`code`**

A stable string to branch on. See [HTTP codes](#http-codes).

---

**`message`**

A description for logs and debugging. The wording may change without notice.

---

**`request_id`**

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](/expression-measurement/docs/authentication) and [Rate limits](#rate-limits).

### HTTP codes

<table>
  <thead>
    <tr>
      <th width="10%">
        Status
      </th>

      <th>
        Code
      </th>

      <th width="12%">
        Endpoints
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        400
      </td>

      <td>
        `message_invalid`
      </td>

      <td>
        Upload
      </td>

      <td>
        The multipart body could not be read, is missing its 

        `file`

         part or carries a part with another name. Audio upload takes exactly one 

        `file`

         part; image upload takes one or more.
      </td>
    </tr>

    <tr>
      <td>
        400
      </td>

      <td>
        `config_invalid`
      </td>

      <td>
        Upload
      </td>

      <td>
        The 

        `config`

         part is not valid JSON, names an unrecognized field, holds a value outside its range or appears more than once.
      </td>
    </tr>

    <tr>
      <td>
        400
      </td>

      <td>
        `audio_decode_failed`
      </td>

      <td>
        Audio upload
      </td>

      <td>
        The audio could not be decoded: a WAV file that is truncated or malformed, is at another sample rate, channel count or sample format, or uses the extensible WAV header, or a file that is empty or is not a whole number of 16-bit samples.
      </td>
    </tr>

    <tr>
      <td>
        400
      </td>

      <td>
        `image_decode_failed`
      </td>

      <td>
        Image upload
      </td>

      <td>
        An image could not be decoded.
      </td>
    </tr>

    <tr>
      <td>
        400
      </td>

      <td>
        `invalid_request`
      </td>

      <td>
        Runs
      </td>

      <td>
        A query parameter has a value the endpoint does not accept, or 

        `cursor`

         is not one the endpoint issued.
      </td>
    </tr>

    <tr>
      <td>
        401
      </td>

      <td>
        No code
      </td>

      <td>
        All
      </td>

      <td>
        The request carried no valid API key. See 

        [Authentication](/expression-measurement/docs/authentication)

        .
      </td>
    </tr>

    <tr>
      <td>
        403
      </td>

      <td>
        `forbidden`
      </td>

      <td>
        Upload
      </td>

      <td>
        Your organization is not permitted to use this endpoint. 

        [Contact our team](https://www.hume.ai/contact-form)

         to request access.
      </td>
    </tr>

    <tr>
      <td>
        404
      </td>

      <td>
        `not_found`
      </td>

      <td>
        All
      </td>

      <td>
        No run with this ID exists in your organization, or no endpoint exists at this path.
      </td>
    </tr>

    <tr>
      <td>
        405
      </td>

      <td>
        `method_not_allowed`
      </td>

      <td>
        All
      </td>

      <td>
        The endpoint does not accept this HTTP method. The 

        `Allow`

         header lists the methods it does accept.
      </td>
    </tr>

    <tr>
      <td>
        413
      </td>

      <td>
        `audio_too_long`
      </td>

      <td>
        Audio upload
      </td>

      <td>
        The request body is over the size limit.
      </td>
    </tr>

    <tr>
      <td>
        413
      </td>

      <td>
        `image_too_large`
      </td>

      <td>
        Image upload
      </td>

      <td>
        The request body or one image is over the size limit, or an image has more pixels than the endpoint accepts.
      </td>
    </tr>

    <tr>
      <td>
        415
      </td>

      <td>
        `unsupported_media_type`
      </td>

      <td>
        Upload
      </td>

      <td>
        The audio is in a format the server recognizes but does not accept, such as MP3 or FLAC, or an image is not a JPEG.
      </td>
    </tr>

    <tr>
      <td>
        429
      </td>

      <td>
        No code
      </td>

      <td>
        All
      </td>

      <td>
        The organization exceeded its rate limit. See 

        [Rate limits](#rate-limits)

        .
      </td>
    </tr>

    <tr>
      <td>
        500
      </td>

      <td>
        `internal_error`
      </td>

      <td>
        All
      </td>

      <td>
        The server failed while serving the request.
      </td>
    </tr>

    <tr>
      <td>
        503
      </td>

      <td>
        `server_busy`
      </td>

      <td>
        All
      </td>

      <td>
        The service is too busy to serve the request now.
      </td>
    </tr>
  </tbody>
</table>

### Handling errors

<table>
  <thead>
    <tr>
      <th width="30%">
        Status
      </th>

      <th>
        What to do
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        400, 405, 413, 415
      </td>

      <td>
        Correct what 

        `code`

         names, or the HTTP method, then resend. The same request fails again if sent unchanged.
      </td>
    </tr>

    <tr>
      <td>
        401, 403
      </td>

      <td>
        Correct the credential or the organization's access: see 

        [Authentication](/expression-measurement/docs/authentication)

         for a 

        `401`

        , and 

        [contact our team](https://www.hume.ai/contact-form)

         to request access for a 

        `403`

        . The request itself needs no change.
      </td>
    </tr>

    <tr>
      <td>
        404
      </td>

      <td>
        If the 

        `run_id`

         came from a response or 

        `session.created`

         moments ago, wait a few seconds and retry, since a run can take a moment to appear. If it still returns 

        `404`

        , the run was not recorded or the ID or path is wrong. See 

        [Run IDs](/expression-measurement/docs/runs#run-ids)

        .
      </td>
    </tr>

    <tr>
      <td>
        500
      </td>

      <td>
        Retry. If it keeps failing, contact support with the 

        `request_id`

        .
      </td>
    </tr>

    <tr>
      <td>
        429, 503
      </td>

      <td>
        Wait the number of seconds in the 

        `Retry-After`

         header, then retry.
      </td>
    </tr>
  </tbody>
</table>

## 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](/expression-measurement/docs/audio/realtime#errors) and [video errors](/expression-measurement/docs/video/realtime#errors).

### Message format

#### error

```json
{
  "type": "error",
  "code": "rate_limited",
  "message": "audio ingest is outpacing the realtime limit; frame dropped",
  "retryable": true
}
```

**`type`**

Always `error`.

---

**`code`**

A stable string to branch on.

---

**`message`**

A description for logs and debugging. The wording may change without notice.

---

**`retryable`**

`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](/expression-measurement/docs/video/realtime#matching-results-to-frames) explains how to pair each reply with the frame it answers.

### Shared codes

<table>
  <thead>
    <tr>
      <th>
        Code
      </th>

      <th width="12%">
        Session
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `message_invalid`
      </td>

      <td>
        Continues
      </td>

      <td>
        A text message was not valid JSON, had no 

        `type`

         field or had a 

        `type`

         the endpoint does not recognize. Media must be sent as binary frames, not as text.
      </td>
    </tr>

    <tr>
      <td>
        `rate_limited`
      </td>

      <td>
        Continues
      </td>

      <td>
        Media arrived faster than the endpoint allows, and the frame was not processed. Slow down, and resend the frame if the stream must be continuous.
      </td>
    </tr>

    <tr>
      <td>
        `config_invalid`
      </td>

      <td>
        Ends
      </td>

      <td>
        A 

        `session.update`

         contained an unrecognized field or an unsupported value, or arrived after the configuration locked at the first media frame. See 

        [Configuration](/expression-measurement/docs/sessions#configuration)

        .
      </td>
    </tr>

    <tr>
      <td>
        `message_too_large`
      </td>

      <td>
        Ends
      </td>

      <td>
        A WebSocket message exceeded the endpoint's size limit: 1 MiB on the audio endpoint, 2 MB on the video endpoint. Send smaller messages.
      </td>
    </tr>

    <tr>
      <td>
        `internal_error`
      </td>

      <td>
        Varies
      </td>

      <td>
        Processing failed unexpectedly. On the audio endpoint the session ends. On the video endpoint the frame is skipped and the session continues, until five consecutive frames fail.
      </td>
    </tr>
  </tbody>
</table>

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](/expression-measurement/docs/runs#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](/expression-measurement/docs/sessions#closing) lists the code for each reason.

<table>
  <thead>
    <tr>
      <th width="12%">
        Close code
      </th>

      <th>
        Preceded by
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        1000
      </td>

      <td>
        `session.closed`

         with 

        `reason`

         set to 

        `client_request`

         or 

        `idle_timeout`
      </td>

      <td>
        The session ended normally: the client sent 

        `session.close`

        , or the session was idle.
      </td>
    </tr>

    <tr>
      <td>
        1008
      </td>

      <td>
        `error`

        , then 

        `session.closed`

         with 

        `reason`

         set to 

        `error`
      </td>

      <td>
        An error ended the session. Open a new connection to start another session.
      </td>
    </tr>

    <tr>
      <td>
        1011
      </td>

      <td>
        Nothing
      </td>

      <td>
        The server could not continue the session. Open a new connection to start another session. See 

        [Connection failures](#connection-failures)

        .
      </td>
    </tr>

    <tr>
      <td>
        1012
      </td>

      <td>
        `session.closed`

         with 

        `reason`

         set to 

        `server_shutdown`
      </td>

      <td>
        The server is restarting. Open a new connection right away to start another session.
      </td>
    </tr>
  </tbody>
</table>

### 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](#rate-limits) 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](/expression-measurement/docs/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.

1. **If the connection drops without a close frame, the session has ended.** Client libraries report this as close code 1006. Open a new connection.
2. **A text message that is not valid UTF-8 ends the session with 1011.**

## Reporting a problem

When [contacting support](/expression-measurement/docs/support), include the identifier of the request or session:

1. **For an upload or run request**, the `request_id` from the response or the error body.
2. **For a realtime session**, the `session_id` from `session.created`.