SnozeDevelopers
API referenceModel sources

Check a provider API key before saving it

Calls the provider with the candidate key and returns whether it was accepted along with the model catalog it exposes, without storing anything. Because it performs a network call on the caller's behalf, it is gated on being able to list the workspace's model sources (`models:read`). A key the provider rejects comes back as `valid: false` rather than as an error.

POST
/v1/workspaces/{workspaceId}/model-sources/validate-key
AuthorizationBearer <token>

Workspace API key created in Workspace settings → API keys. Scopes on the key bound what it can read and write.

In: header

Path Parameters

workspaceId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/workspaces/string/model-sources/validate-key" \  -H "Content-Type: application/json" \  -d '{    "kind": "openrouter",    "key": {      "apiKey": "string"    }  }'
{  "data": {    "valid": true,    "models": [      {        "id": "string",        "label": "string",        "description": "string",        "contextLength": 0,        "pricing": {          "prompt": "string",          "completion": "string"        }      }    ]  }}