API and MCP
Credentials
The API tokens, Spice Passes and sign-ins a project holds
List credentials
GET /api/v1/project/{projectId}/credential
Credentials: Dashboard sign-in only. API tokens are refused.
Every credential this project holds: API tokens, Spice Passes and sign-ins, including revoked and expired ones. Secrets are never returned. Only a dashboard session may call this. Requires project:edit.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectId required | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
200 | The project's credentials, newest first. | array of Credential |
401 | The token is missing, expired, revoked, or is an API token. | Error |
403 | The token is valid but not allowed to do this. | Error |
500 | A fault on our side. | Error |
Example
curl -X GET "https://api.spicelabs.io/api/v1/project/<projectId>/credential" \
-H "Authorization: Bearer $SPICE_API_TOKEN" Cancel a credential
DELETE /api/v1/project/{projectId}/credential/{jti}
What it changes: Anything using this credential is refused from its next request and it cannot be brought back; canceling a sign-in signs that person out of every project.
Credentials: Dashboard sign-in only. API tokens are refused.
Cancels one of this project's credentials: an API token, a Spice Pass or a sign-in. A canceled credential stops working immediately and cannot be restored. Canceling a sign-in also ends the same sign-in on every other project, so the person is signed out everywhere. Only a dashboard session may call this. Requires project:edit.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectId required | path | string (uuid) | |
jti required | path | string |
Responses
| Status | Description | Body |
|---|---|---|
204 | The credential is canceled. | |
401 | The token is missing, expired, revoked or of the wrong kind. | Error |
403 | The token is valid but not allowed to do this. | Error |
404 | No credential with this id belongs to this project. | Error |
500 | A fault on our side. | Error |
Example
curl -X DELETE "https://api.spicelabs.io/api/v1/project/<projectId>/credential/<jti>" \
-H "Authorization: Bearer $SPICE_API_TOKEN" Create an API token
POST /api/v1/project/{projectId}/credential/api-token
Credentials: Dashboard sign-in only. API tokens are refused.
Creates an API token for this project with the permissions you name. The token holds a fixed list of permissions, at most the ones you hold on the project yourself, and acts in this project and its organization. It lasts duration_days days, at least 1 and 14 when omitted. Its secret is returned once, in bearer_token, and cannot be retrieved again. Only a dashboard session may call this, never an API token. Requires project:edit.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectId required | path | string (uuid) |
Request body
application/json (required)
Responses
| Status | Description | Body |
|---|---|---|
201 | The new token, including its secret. | Credential |
400 | A permission is unknown, or one you do not hold on this project; or the request is invalid. | Error |
401 | The token is missing, expired, revoked or of the wrong kind. | Error |
403 | The token is valid but not allowed to do this. | Error |
500 | A fault on our side. | Error |
Example
curl -X POST "https://api.spicelabs.io/api/v1/project/<projectId>/credential/api-token" \
-H "Authorization: Bearer $SPICE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '<JSON body>' Create a Spice Pass
POST /api/v1/project/{projectId}/credential/spice-pass
Credentials: Dashboard sign-in only. API tokens are refused.
Creates a Spice Pass for this project: the credential the Spice Labs CLI uses to start, report and complete uploads and surveys. It reaches only this project and lasts duration_days days, 14 when omitted and at most 367. The pass is returned once, in jwt, and cannot be retrieved again; it is listed with the project's credentials and can be canceled there. Only a dashboard session may call this, never an API token. Requires project:edit.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectId required | path | string (uuid) | The project's id. |
Request body
application/json (optional)
Responses
| Status | Description | Body |
|---|---|---|
201 | The new Spice Pass in jwt. | SpicePass |
400 | duration_days is below 1 or above 367. | Error |
401 | The token is missing, expired, revoked, or is an API token. | Error |
403 | The token is valid but not allowed to do this. | Error |
500 | A fault on our side. | Error |
Example
curl -X POST "https://api.spicelabs.io/api/v1/project/<projectId>/credential/spice-pass" \
-H "Authorization: Bearer $SPICE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '<JSON body>'