Introduction

The MEDKit REST API gives your game or other Twitch extension direct access to GameLink services through a persistent bidirectional connection to the Muxy Cloud that supports the WebSocket Protocol .

The REST API has two base URLs:

Base URL

Description

api.muxy.io

Production environment

sandbox.api.muxy.io

Debugging endpoints for the development environment.

These are completely separate environments that don’t share information and have different levels of security. Sandbox is used for testing only and can be easily used by developers, but it inaccessible by production viewers.

All endpoints are versioned by path; for example /v1/e/authenticate.

Authorization

The Authorization header is required for almost all API requests.
Exceptions are:

  • The authtoken endpoint, which you use to obtain a token for the sandbox development environment. This token is not accepted in the production environment.
  • The pin endpoint, which is authorized only by a Twitch Client ID, and is used to obtain credentials for subsequent calls to the MedKit REST API.

The value of the Authorization header is a space-separated Extension ID/JWT pair of the form Authorization: 12345 eyJhbGciOiJIU...
For example:

curl -X POST https://sandbox.api.muxy.io/v1/e/viewer_state \
  -H "Authorization: 12345 eyJhbGciOiJIU"

Endpoint summary

❗️

Detailed API doc under construction

Endpoint

Usage

authtoken

Available only on sandbox. An unauthorized POST call generates and returns a JavaScript Web Token (JWT), valid only in the sandbox testing environment.

pin

In an unauthorized POST call, a broadcaster exchanges a Twitch Client ID for credentials to use in subsequent calls to the MedKit REST API.

user-info

description

GET returns basic information about the current authorized extension.

game_codes

Muxy maintains and reports developer-defined configuration data with two scopes, extension-wide and channel-wide. Each config store is defined by a single JSON object containing key-value pairs. The keys are developer-defined. Use these endpoints to set, modify, and retrieve configuration keys and values.

  • Use a GET request to all_config to retrieve the current content of all configuration stores.
  • The individual config-store endpoints support GET, POST, and PATCH operations.

Endpoint

Usage

all_config

Retrieves all configuration data in a single call.

extension_config

Maintains and reports per-extension configuration across channels.

channel_config

Maintains and reports per-channel configuration for all extensions running in a channel.

Muxy maintains and reports developer-defined state data with four different scopes. Each state store is defined by a single JSON object containing key-value pairs. The keys are developer-defined. Use these endpoints to set, modify, and retrieve state keys and values.

  • Use a GET request to all_state to retrieve the current content of all state stores.
  • The individual state-store endpoints support GET, POST, and PATCH operations.

Endpoint

Usage

all_state

Retrieves all four state stores in a single call.

extension_state

Maintains and reports per-extension state information.

viewer_state

Maintains and reports per-viewer state information.

extension_viewer_state

Maintains and reports per-viewer state information for each extension.

channel_state

Maintains and reports per-channel state information for all extensions running in a channel.

The MEDKit REST API supports a variety of techniques for aggregating viewer data.

  • Accumulating data that users provide is the simplest form of aggregation.
  • A ranking service collects answers to open-ended questions, and counts matching responses.
  • A polling service helps you create and manage viewer polls, collect viewer votes, and work with voting results.
  • A trivia quiz service helps you implement a sophisticated voting-and-reward system with multiple-choice questions. An admin creates and manages the poll and users submit choices. The service collects user responses and provides statistical data.

Endpoint

Usage

accumulate

Collect user input for developer-defined data.

rank

Create open-ended questions, collect user answers, and get statistics on popular answers.

vote
vote/vote_logs

Create and manage polls, cast and collect users' votes, get voting results and logs.

trivia

Create sets of multiple-choice questions, collect user choices, get statistics on user choices.

Communication API

Additional endpoints support administrative services, including back-channel and server-to-server communication.

Endpoint

Usage

Broadcast Messaging
broadcast
broadcast_extension
whisper_self

Broadcast messages to viewers on a per-channel or per-extension basis.

This service also enables server-to-server and back-channel communication.

Transaction Management
transactions

Handle purchases of products that you offer through the Twitch Extension Bits Monetization API.