Skip to content

Extension Viewer State

GET /extension_viewer_state

Returns extension-wide state for the current viewer. A backend JWT may use userID to select one Twitch user. A validated admin JWT may instead pass up to 1,000 comma-separated Twitch IDs in user_ids; the response is then keyed by each ID whose state exists.

Authorization

Send Authorization: <Twitch Extension Client ID> <Muxy JWT>. The JWT role must satisfy the endpoint requirements shown in the examples.

Parameters

Name In Required Type Constraints Description
userID query no string none Twitch user ID to read when using a backend JWT. Ignored for other roles and superseded when user_ids is present.
user_ids query no string none Comma-separated Twitch user IDs for an admin-only batch read. At most 1,000 IDs are accepted; missing state entries are omitted from the result.

Responses

200 Response

The selected viewer state, or an object keyed by Twitch user ID for a user_ids batch request.

Content type: application/json

Schema
{
  "type": "object",
  "additionalProperties": true,
  "description": "Developer-defined state. Batch responses map each found Twitch user ID to its state object."
}
Current viewer
{
  "favorite_color": "blue"
}
Admin batch
{
  "12345": {
    "favorite_color": "blue"
  },
  "67890": {
    "favorite_color": "green"
  }
}

400 Error

State lookup failed, or more than 1,000 IDs were supplied.

Content type: application/json

Schema
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string"
    }
  }
}
Example
{
  "reason": "Too many ids specified"
}

403 Error

The JWT role is not allowed to perform this operation.

Content type: application/json

Schema
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string"
    }
  }
}
Example
{
  "reason": "role is not authorized"
}

Examples

Curl

curl --request GET \
  --url https://api.muxy.io/v1/e/extension_viewer_state \
  --header 'authorization: <Client ID> <any JWT>' \
  --header 'content-type: application/json'

Generated API reference

This endpoint is generated from rest-v1.yaml.