SnippetsReplace snippets
Snippets

Replace snippets

Replace all custom code snippets for a client. Snippets are arbitrary HTML or JavaScript injected via remote configuration. After updating, the API rebuilds the client's remote configuration in KV.

curl -X PUT "https://api.mythic-analytics.com/api/v1/clients/example_string/snippets" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "snippets": [
    {
      "code": "example_string",
      "description": "example_string",
      "enabled": true,
      "trigger_rules": {}
    }
  ]
}'
{
  "success": true,
  "data": [
    {
      "id": "9xP3qLmN-58cc-4372-a567-0e02b2c3d479",
      "code": "<script src="https://widgets.mythic-analytics.com/checkout.js"></script>",
      "description": "Checkout widget",
      "enabled": true,
      "trigger_rules": {}
    }
  ]
}
PUT
/clients/{id}/snippets
PUT
Security Scheme
Bearer Tokenstring
Required

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
path
idstring
Required

Client identifier.

Pattern: ^[a-zA-Z0-9_-]{1,255}$
Content-Typestring
Required

The media type of the request body

Options: application/json
snippetsarray
Required

Array of snippet objects. Replaces all existing snippets.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

Path Parameters

idstring
Required

Client identifier.

Body

application/json
snippetsarray
Required

Array of snippet objects. Replaces all existing snippets.

Responses

successboolean
dataarray