Skip to main content
PATCH
/
api
/
v1
/
tokensets
/
{id}
/
modes
/
{modeId}
Update Mode
curl --request PATCH \
  --url https://app.tokencraft.dev/api/v1/api/v1/tokensets/{id}/modes/{modeId} \
  --header 'Authorization: Bearer <token>'

Update Mode

Updates an existing mode. Only provided fields will be updated.
PRO Plan Required - This endpoint requires a PRO or TEAM subscription plan. API write access is not available on the FREE plan.

Endpoint

PATCH /api/v1/tokensets/{id}/modes/{modeId}

Request

Path Parameters

ParameterTypeRequiredDescription
idstringYesTokenset ID
modeIdstringYesMode ID

Body Parameters

ParameterTypeRequiredDescription
namestringNoNew mode name (max 255 characters)
is_defaultbooleanNoSet as default mode
All body parameters are optional. Only provided fields will be updated.

Response

Status: 200 OK
{
  "id": "mode-dark",
  "tokenset_id": "tokenset-123",
  "name": "Dark Mode",
  "is_default": true,
  "created_at": "2025-01-15T10:00:00Z",
  "updated_at": "2025-01-15T14:30:00Z"
}

Examples

curl -X PATCH https://app.tokencraft.dev/api/v1/tokensets/tokenset-123/modes/mode-dark \
  -H "Authorization: Bearer dtk_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Dark Mode"
  }'

Error Responses

400 Bad Request

{
  "error": "Name must be a non-empty string"
}

404 Not Found

{
  "error": "Mode not found"
}

Default Mode Behavior

When setting is_default: true:
  • All other modes in this tokenset are set to is_default: false
  • Only one mode can be default per tokenset

Next Steps