Visitar URL original
Create Agent Secret | Klaviyo API ReferenceSkip to content

This page is available as Markdown at https://developers.klaviyo.com/en/reference/create_agent_secret_beta.md. Its OpenAPI document is at https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/create_agent_secret_beta.json. An index of every page is at https://developers.klaviyo.com/llms.txt.

KlaviyoKlaviyoDevelopers

This endpoint is in beta. Call it with the revision header 2026-10-15.pre. Beta endpoints may change before they're generally available. See our versioning and deprecation policy for more information.

POSThttps://a.klaviyo.com/api/agent-secrets

Creates a secret for use by one or more Customer Agent tools.

The provided plaintext value is encrypted before persistence and is never exposed after creation. Subsequent responses return only the mask (last 3 characters) and non-sensitive metadata. Secret names are trimmed of leading and trailing whitespace before validation, and both the resulting name and provided value must be non-empty. If another secret already exists with the same name for the calling company, the API returns 409 Conflict.

Revision header
revision: 2026-10-15.prerequired
Scopes
agents:write
Rate limits
Burst: 10/sSteady: 150/m

Query parameters

  • fields[agent-secret]#string[]

    For more information please visit API overview

    Allowed values:
    • created_at
    • id
    • mask
    • name
    • updated_at

Headers

  • revision#stringrequired

    API endpoint revision (format: YYYY-MM-DD[.suffix])

    2026-10-15.pre

Request body

Content type: application/vnd.api+jsonrequired

  • data#objectrequired
    Show 2 fields
    • type#stringrequired
      Allowed values:
      • agent-secret
    • attributes#objectrequired
      Show 2 fields
      • name#stringrequired

        Display name for the secret. Leading and trailing whitespace is stripped before validation; the resulting name must be non-empty. Not the alias used in tool configs.

        Example: Order API key

      • value#stringrequired

        Plaintext secret value. Must be non-empty. Encrypted prior to persistence and never returned in any response.

        Example: sk_live_example

Responses

201Success

Content type: application/vnd.api+json

  • data#objectrequired
    Show 5 fields
    • type#stringrequired
      Allowed values:
      • agent-secret
    • id#stringrequired

      Agent Secret identifier.

      Example: sec_abc123

    • attributes#objectrequired
      Show 4 fields
      • name#stringrequired

        Display name for the secret.

        Example: Order API key

      • mask#stringrequired

        Last 3 characters of the plaintext value, for visual disambiguation. The plaintext itself is never returned.

        Example: **********ken

      • created_at#string<date-time>required

        Date and time when the secret was created.

        Example: 2026-05-13T12:00:00+00:00

      • updated_at#string<date-time>required

        Date and time when the secret was last updated.

        Example: 2026-05-13T12:00:00+00:00

    • relationships#objectrequired
      Show 1 field
      • agent-tools#objectrequired
        Show 2 fields
        • data#object[]
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • agent-tool
          • id#stringrequired

            Agent tool IDs that reference this secret.

4XXClient Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string

5XXServer Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string