> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rasen.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rasen.ai/_mcp/server.

# Publish the reviewed draft

POST https://api.rasen.ai/v1/agents/{agent_id}/publish

Atomically freezes the complete reviewed configuration (prompt, settings, variables, default tools, authored tools with their pinned credential versions, MCP connections and eligible direct-library knowledge) and makes it live for new calls in one step. Ready library sources enter an immutable retrieval snapshot; fallback library sources enter bounded prompt context. If-Match must be the publication token (ETag) from getAgentDraft or getAgentDraftDiff. The server recomputes it inside the publish transaction; a mismatch returns 409 draft_conflict. A failed or refused publication leaves the previous live version active and the draft unchanged. Calls already admitted keep the version they started with. Same content may reuse a publication; request replay never reactivates an older version. An archived agent is refused with agent_archived. conflict with details.reason=live_version_changed: another publication or rollback changed the live version while this publication was running; read the agent, then publish again with a new intent if still wanted. tool_pre_call_name: a variable of the draft has the name of its before-call tool; rename the tool or the variable.

Reference: https://docs.rasen.ai/enterprise/api-reference/agents/publish

## Authentication

- `Authorization` header (bearer token, required) — An organisation-owned key whose secret starts ra_org_. The Owner or an Admin of an organisation that Rasen has invited makes it in the app; no API operation makes, changes, rotates or revokes a key. On a workspace operation send the workspace ID in the Rasen-Workspace header; without it the answer is 400 invalid_request with details.field Rasen-Workspace. A workspace outside the organisation or outside the key's workspace list is 404 not_found. An organisation that is not invited gets 403 organisation_api_not_enabled.

## Request

### Path parameters

- `agent_id` (string, required) — Resource identity within the authenticated workspace.

### Headers

- `If-Match` (string, required) — Strong ETag from the resource being changed. Draft/tool/variable/publication operations use the complete agent draft ETag; number operations use the number ETag; MCP update uses its own ETag. Never retry a stale edit by blindly using a fresh ETag. Agent identity edits use the identity ETag; knowledge-source reingest uses the source ETag. A stale revision returns 409: draft_conflict for agent, draft, variable, tool, MCP server and publication-token checks; conflict with details.reason=stale_revision for phone numbers and knowledge sources. A missing header returns 428 revision_required. Same-intent replay uses the original If-Match and returns its receipt before checking current revision.
- `Idempotency-Key` (string, required) — Stable key per logical intent, 1–255 printable characters. Persist it before sending. Retry the same key/body after an uncertain result for 24 hours. A changed body conflicts. Beyond retention, reconcile the resource before retrying; this is not permanent deduplication. Current authorization is rechecked on replay. Evaluation order: authenticate and check current authorization; look up intent; replay its stored receipt before checking the current revision; only a new intent evaluates If-Match and executes. Fingerprint includes method, path, body and original If-Match. A changed request returns idempotency_key_reused. The server stores only a keyed (HMAC) fingerprint, and no error or response ever returns a fingerprint or hash of a request. In-flight intent returns 409 idempotency_in_progress with Retry-After; retry the same intent after reconciliation. Receipts describe that attempt, not current resource state. A replay returns the original status code and body, with the response header Idempotent-Replayed: true.
- `Rasen-Workspace` (string, required) — The ID of the workspace that this operation acts in. It must be a workspace of the key's organisation and in the key's workspace list. A missing, empty or malformed value is 400 invalid_request with details.field Rasen-Workspace; a workspace outside the organisation or the key's workspace list is the hidden 404 not_found.

## Response

### 200

Publish the reviewed draft.

- `version` (Version, required) — Immutable configuration snapshot. Does not include secret values, broker IDs, storage paths or serving internals. Referenced tools/knowledge are frozen at publish; current revocations still apply. tools contains the frozen safe tool descriptors, not a lookup of current mutable tools. Sensitive variable values are null/redacted. All reads and diffs, including draft, variable list and publication history, return pii/confidential values as null with a redacted marker. Null without that marker means an actual null. Credentials are never returned. Existing authored end_call and fixed transfer_to_number descriptors must be projected into default_tools and excluded from authored tools, including retained versions. Runtime-injected end_call maps to enabled=true. Disabled or absent transfer maps to disabled policy. Conflicting descriptors or unsupported legacy customization refuse public configuration reads/writes with a registered safe incompatibility reason until explicitly migrated; never silently discard behavior.
- `created` (boolean, required)
- `live_version_id` (string, required) — Opaque pub identifier. Do not parse its contents.

## Errors

### 400 Bad Request Error

Invalid input or cursor. Correct the request.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 401 Unauthorized Error

Invalid, expired or revoked API key. Creator departure or membership changes do not invalidate a workspace key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 403 Forbidden Error

Operation not allowed by current credential or workspace access.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 404 Not Found Error

Resource absent or not visible in this workspace.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 409 Conflict Error

Conflict. Not retryable: read the current state, fix the request and send a new request. The one exception is idempotency_in_progress, which carries Retry-After: wait, then resend the identical request with the same Idempotency-Key. The operation lists its codes in x-error-codes; branch on error.code and, for conflict, error.details.reason.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 422 Unprocessable Entity Error

The request is well formed but refused, for example a destination that is not a permitted public address.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 428 Precondition Error

Required If-Match revision is absent.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 429 Too Many Requests Error

Rate limited. Respect Retry-After and retry the same intent where permitted.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 500 Internal Server Error

Internal error. The effect may have happened. Retry the same request with the same Idempotency-Key; read the resource before creating a new intent. For an operation that takes an Idempotency-Key, a client retry with the same key is safe: the server replays the stored outcome if the first attempt took effect; if the first attempt had no effect, the retry performs the operation once. Never retry with a new key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

### 503 Service Unavailable Error

Service unavailable. Respect Retry-After where present. For an operation that takes an Idempotency-Key, a client retry with the same key is safe: the server replays the stored outcome if the first attempt took effect; if the first attempt had no effect, the retry performs the operation once. Never retry with a new key.

- `error` (ErrorResponseError, required) — Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

## Types

### Version

Immutable configuration snapshot. Does not include secret values, broker IDs, storage paths or serving internals. Referenced tools/knowledge are frozen at publish; current revocations still apply. tools contains the frozen safe tool descriptors, not a lookup of current mutable tools. Sensitive variable values are null/redacted. All reads and diffs, including draft, variable list and publication history, return pii/confidential values as null with a redacted marker. Null without that marker means an actual null. Credentials are never returned. Existing authored end_call and fixed transfer_to_number descriptors must be projected into default_tools and excluded from authored tools, including retained versions. Runtime-injected end_call maps to enabled=true. Disabled or absent transfer maps to disabled policy. Conflicting descriptors or unsupported legacy customization refuse public configuration reads/writes with a registered safe incompatibility reason until explicitly migrated; never silently discard behavior.

- `id` (string, required) — Opaque pub identifier. Do not parse its contents.
- `agent_id` (string, required) — Opaque agent identifier. Do not parse its contents.
- `number` (integer, required)
- `created_at` (datetime, required)
- `prompt` (string, required)
- `voice` (VoiceSelectionRead, required)
- `settings` (Settings, required) — Effective settings after defaults resolve. Not a PATCH input.
- `referenced_variables` (list of string, required)
- `tool_ids` (list of string, required)
- `retrieval_snapshot_id` (string, required, nullable)
- `tools` (list of Tool, required) — The frozen authored tools: each during-call tool, and the before-call tool (timing pre_call) when the version has one.
- `variables` (list of Variable, required)
- `fallback_source_ids` (list of string, required)
- `default_tools` (DefaultTools, required) — Effective built-in policies. end_call is enabled by default for every agent, including agents created before this field existed; only an explicit end_call.enabled=false policy turns it off. transfer starts disabled with a null destination. Publication freezes the policy; rollback restores it subject to current revocation. Clients must accept additional policy keys.

### ErrorResponseError

Only code and message are required. Rasen sends details, request_id and retry on every error, but clients must parse an error that lacks them, so a typed error is never lost to a parsing failure.

- `code` (string, required) — Stable code. Branch on code (and details.reason for conflict), never on message. Each code has one HTTP status; see components.x-error-catalog.
- `message` (string, required) — Safe description; no provider payload or submitted secrets.
- `details` (map from string to any, optional) — Safe code-specific details. The public fields for each code are listed in components.x-error-catalog. Details never contain a request fingerprint, a hash of a request, secret material or another tenant's data. forbidden may include required_capabilities (a list).
- `request_id` (string, optional) — Same value as the X-Request-Id header. Quote it to support.
- `retry` (string, optional) — Retry class of this code: no (fix the request or state first), yes (retry the same request and the same Idempotency-Key), retry_after (wait for Retry-After, then retry the same request). Open response vocabulary. Preserve unknown values; never assume they mean success.

### VoiceSelectionRead

- `voice_id` (string, required, nullable) — Choose from GET /voices. Null explicitly resets to the supported default.

### Settings

Effective settings after defaults resolve. Not a PATCH input.

- `purpose` (string, required, nullable)
- `goals` (list of string, required)
- `call_direction` (string, required, nullable) — Open response vocabulary. Preserve unknown values.
- `grammatical_gender` (string, required, nullable) — Open response vocabulary. Preserve unknown values.
- `additional_context` (string, required, nullable)
- `language` (string, required) — Agent language. Known values are en (Indian English), en-US (US English), hi and hinglish. Open response vocabulary: preserve unknown values; never assume they mean success.
- `agent_name` (string, required, nullable)
- `first_message` (string, required)
- `timezone` (string, required) — IANA timezone.
- `max_call_duration_seconds` (integer, required, nullable) — Platform default on create/reset: 1800; omission in PATCH keeps the existing value.
- `inactivity_timeout_seconds` (integer, required, nullable) — Platform default on create/reset: 30; omission in PATCH keeps the existing value.
- `user_turn_timeout_ms` (integer, required, nullable)
- `ivr_hangup` (boolean, required)
- `voicemail_detection` (boolean, required)
- `voicemail_action` (string, required) — What the agent does when voicemail detection finds a voicemail: `hang_up` ends the call at once; `leave_message` speaks `voicemail_message` and then ends the call. Open response vocabulary. Preserve unknown values; never assume they mean success.
- `voicemail_message` (string, required) — The message the agent speaks on a voicemail when `voicemail_action` is `leave_message`, at most 500 characters. It may name call variables as `{{name}}`, filled in once per call. `leave_message` with a blank message is refused `invalid_request` on `voicemail_message`.
- `dtmf_enabled` (boolean, required)
- `dtmf_timeout_seconds` (integer, required)
- `dtmf_digit_limit` (integer, required)
- `dtmf_termination_key` (string, required, nullable)
- `bg_audio` (string, required, nullable) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `bg_volume` (integer, required)
- `extraction_fields` (list of ExtractionFieldRead, required)

### Tool

Public authored configuration with credential references, never values. Writes change the draft; existing published tool definitions stay frozen. Tool name is unique within an agent draft and is its reconciliation key. Duplicate name returns tool_name_conflict. Credential references pin exact secret versions; rotation never changes them.

- `id` (string, required) — Opaque tool identifier. Do not parse its contents.
- `agent_id` (string, required) — Opaque agent identifier. Do not parse its contents.
- `revision` (string, required)
- `configuration` (ToolConfigurationSafe, required)
- `created_at` (datetime, required)

### Variable

Literal prompt default, not a credential. Runtime call variables can override defaults. Use tool secrets for credentials; never place a credential in a prompt variable. All reads and diffs, including draft, variable list and publication history, return pii/confidential values as null with a redacted marker. Null without that marker means an actual null. Credentials are never returned.

- `key` (string, required)
- `value` (string, required, nullable)
- `description` (string, required, nullable)
- `sensitivity` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `redacted` (boolean, required)

### DefaultTools

Effective built-in policies. end_call is enabled by default for every agent, including agents created before this field existed; only an explicit end_call.enabled=false policy turns it off. transfer starts disabled with a null destination. Publication freezes the policy; rollback restores it subject to current revocation. Clients must accept additional policy keys.

- `end_call` (EndCallPolicyRead, required) — Only enable or disable. Name, prompt, description and parameters are not editable. Independent duration limits and external hangup still apply. Default enabled=true; only an explicit false disables it.
- `transfer` (TransferPolicyRead, required) — Enabled requires at least one destination. Disabled may retain destinations for later use. destinations is the list of the call-transfer contract; destination_number is the alias of its first e164 destination (null when none).

### ExtractionFieldRead

Names are unique. choices is required only for selector. required is an extraction instruction, not a guarantee the caller supplies the fact. Missing evidence must not invent a value.

- `name` (string, required)
- `type` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `description` (string, required, nullable)
- `required` (boolean, required, nullable)
- `choices` (list of string, required, nullable)

### ToolConfigurationSafe

- `kind`: `webhook` (webhook)
  - `deadline_ms` (integer, required, nullable, default: 8000)
  - `definition` (WebhookDefinitionSafe, required) — Public HTTPS destination; platform egress policy rejects private/metadata addresses and unsafe redirects at write and execution. No credentials in URL.
  - `description` (string, required)
  - `effect_id_name` (string, required, nullable)
  - `effect_id_placement` (string, required, nullable) — Open response vocabulary. Preserve unknown values; never assume they mean success.
  - `max_response_bytes` (integer, required, nullable, default: 32768)
  - `name` (string, required)
  - `retry_posture` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
  - `side_effect` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
  - `wait_for_response` (boolean, required, nullable, default: true)
  - `timing` (string, optional) — Open response vocabulary. Preserve unknown values; never assume they mean success. When the tool runs: during_call, or pre_call for the agent's before-call tool (see WebhookToolWrite.timing). A tool saved before timing existed reads during_call. Every read carries it; only a replayed answer that was recorded before version 1.12.0 has none.
- `kind`: `mcp` (mcp)
  - `deadline_ms` (integer, required, nullable, default: 8000)
  - `definition` (McpDefinitionRead, required)
  - `description` (string, required)
  - `max_response_bytes` (integer, required, nullable, default: 32768)
  - `name` (string, required)
  - `retry_posture` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
  - `side_effect` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
  - `wait_for_response` (boolean, required, nullable, default: true)

### EndCallPolicyRead

Only enable or disable. Name, prompt, description and parameters are not editable. Independent duration limits and external hangup still apply. Default enabled=true; only an explicit false disables it.

- `enabled` (boolean, required)

### TransferPolicyRead

Enabled requires at least one destination. Disabled may retain destinations for later use. destinations is the list of the call-transfer contract; destination_number is the alias of its first e164 destination (null when none).

- `enabled` (boolean, required)
- `destination_number` (string, required, nullable)
- `destinations` (list of TransferDestinationRead, required) — The destination list; 1 to 10 when enabled. destination_number is the first e164 destination, or null.

### WebhookDefinitionSafe

Public HTTPS destination; platform egress policy rejects private/metadata addresses and unsafe redirects at write and execution. No credentials in URL.

- `url` (string, required)
- `method` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `headers` (list of ToolHeaderSafe, required, nullable)
- `parameters` (list of ToolParameterRead, required, nullable)
- `content_type` (string, required, nullable, default: application/json) — Open response vocabulary. Preserve unknown values; never assume they mean success.

### McpDefinitionRead

- `server_id` (string, required) — Opaque mcp identifier. Do not parse its contents.
- `remote_tool_name` (string, required)
- `schema_digest` (string, required)

### TransferDestinationRead

One named destination of the built-in transfer. The model sees id, label and when_to_use; it never sees the target.

- `id` (string, required) — Server-generated when the destination is created; never changes. Send it back unchanged to edit a destination; omit it to add one.
- `label` (string, required)
- `when_to_use` (string, required)
- `target` (TransferTarget, required) — Where a destination transfers the caller. Which kinds a call can dial is decided at call time by the call's carrier and region; a destination the call cannot use is left out of the tool.
- `ring_timeout_s` (integer, required, default: 30)
- `handoff_message` (string, required, nullable) — Spoken before the transfer; the default text when null.

### ToolHeaderSafe

A secret header returns only its authorized credential reference; never inline material.

- `name` (string, required)
- `value_type` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `credential` (SecretReferenceRead, required, nullable) — Pinned reference to one exact credential version. Never follows rotation: to adopt a new version, replace the tool or MCP server with the new version, then publish each affected agent. No secret material in responses.
- `variable` (string, required, nullable)

### ToolParameterRead

- `name` (string, required)
- `location` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `source` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `value` (ToolParameterReadValue, required, nullable) — Constant scalar or dynamic variable name; omit for model parameters. Null constant is not accepted.
- `required` (boolean, required, nullable, default: false)
- `schema` (ToolParameterReadSchema, required)
- `fields` (list of ToolParameterRead, optional, nullable) — The fields of a group (schema.type object). Null on every other parameter.
- `items` (ToolParameterItemsRead, optional, nullable) — The item shape of a list (schema.type array). Null on every other parameter.
- `when_empty` (string, optional, nullable) — null (the JSON string) when an optional value that the model leaves out is sent as JSON null; JSON null when it is left out of the request. Open response vocabulary. Preserve unknown values; never assume they mean success.

### TransferTarget

Where a destination transfers the caller. Which kinds a call can dial is decided at call time by the call's carrier and region; a destination the call cannot use is left out of the tool.

- `kind`: `e164` (e164)
  - `e164` (string, required)
- `kind`: `trunk_extension` (trunk_extension)
  - `extension` (string, required)
  - `trunk_id` (string, required)
- `kind`: `sip_uri` (sip_uri)
  - `uri` (string, required)

### SecretReferenceRead

Pinned reference to one exact credential version. Never follows rotation: to adopt a new version, replace the tool or MCP server with the new version, then publish each affected agent. No secret material in responses.

- `secret_id` (string, required) — Opaque sec identifier. Do not parse its contents.
- `version` (integer, required)

### ToolParameterReadValue

Constant scalar or dynamic variable name; omit for model parameters. Null constant is not accepted.

- string
- double
- boolean

### ToolParameterReadSchema

- `type` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `enum` (list of ToolParameterReadSchemaEnumItems, required, nullable)
- `description` (string, required, nullable)
- `minimum` (double, required, nullable)
- `maximum` (double, required, nullable)

### ToolParameterItemsRead

The shape of one item of a list (schema.type array). Present only on a list.

- `schema` (ToolParameterItemsReadSchema, required)
- `fields` (list of ToolParameterRead, optional, nullable) — The fields of each item when the item is a group. Null for a list of plain values.

### ToolParameterReadSchemaEnumItems

- string
- double
- boolean

### ToolParameterItemsReadSchema

- `type` (string, required) — Open response vocabulary. Preserve unknown values; never assume they mean success.
- `enum` (list of ToolParameterItemsReadSchemaEnumItems, required, nullable)
- `description` (string, required, nullable)
- `minimum` (double, required, nullable)
- `maximum` (double, required, nullable)

### ToolParameterItemsReadSchemaEnumItems

- string
- double
- boolean

## Examples

**Response**

```json
{
  "version": {
    "id": "pub_01j00000000000000000000000",
    "agent_id": "agent_01j00000000000000000000000",
    "number": 1,
    "created_at": "2026-09-25T10:00:00Z",
    "prompt": "example",
    "voice": {
      "voice_id": "voice_01j00000000000000000000000"
    },
    "settings": {
      "purpose": null,
      "goals": [],
      "call_direction": null,
      "grammatical_gender": null,
      "additional_context": null,
      "language": "en",
      "agent_name": "example",
      "first_message": "example",
      "timezone": "Asia/Kolkata",
      "max_call_duration_seconds": 60,
      "inactivity_timeout_seconds": 1,
      "user_turn_timeout_ms": 250,
      "ivr_hangup": true,
      "voicemail_detection": true,
      "voicemail_action": "hang_up",
      "voicemail_message": "",
      "dtmf_enabled": true,
      "dtmf_timeout_seconds": 1,
      "dtmf_digit_limit": 1,
      "dtmf_termination_key": "#",
      "bg_audio": "office",
      "bg_volume": 0,
      "extraction_fields": [
        {
          "name": "appointment_confirmed",
          "type": "text",
          "description": "example",
          "required": true,
          "choices": [
            "example"
          ]
        }
      ]
    },
    "referenced_variables": [
      "example"
    ],
    "tool_ids": [
      "example"
    ],
    "retrieval_snapshot_id": "retrieval_snapshot_01j00000000000000000000000",
    "tools": [
      {
        "id": "tool_01j00000000000000000000000",
        "agent_id": "agent_01j00000000000000000000000",
        "revision": "example",
        "configuration": {
          "kind": "webhook",
          "deadline_ms": 8000,
          "definition": {
            "url": "https://api.example.com/orders",
            "method": "GET",
            "headers": [
              {
                "name": "Authorization",
                "value_type": "secret",
                "credential": {
                  "secret_id": "sec_01j00000000000000000000000",
                  "version": 1
                },
                "variable": "customer_name"
              }
            ],
            "parameters": [
              {
                "name": "lookup_order",
                "location": "path",
                "source": "model",
                "value": "example",
                "required": false,
                "schema": {
                  "type": "string",
                  "enum": [
                    "example"
                  ],
                  "description": "example",
                  "minimum": 1,
                  "maximum": 1
                }
              }
            ],
            "content_type": "application/json"
          },
          "description": "example",
          "effect_id_name": "example",
          "effect_id_placement": "header",
          "max_response_bytes": 32768,
          "name": "lookup_order",
          "retry_posture": "none",
          "side_effect": "none",
          "wait_for_response": true
        },
        "created_at": "2026-09-25T10:00:00Z"
      }
    ],
    "variables": [
      {
        "key": "customer_name",
        "value": "example",
        "description": "example",
        "sensitivity": "public",
        "redacted": true
      }
    ],
    "fallback_source_ids": [
      "example"
    ],
    "default_tools": {
      "end_call": {
        "enabled": true
      },
      "transfer": {
        "enabled": true,
        "destination_number": "+12025550123",
        "destinations": [
          {
            "id": "xfd_default",
            "label": "Support team",
            "when_to_use": "The caller asks to speak to support.",
            "target": {
              "kind": "e164",
              "e164": "+12025550123"
            },
            "ring_timeout_s": 30,
            "handoff_message": null
          }
        ]
      }
    }
  },
  "created": true,
  "live_version_id": "pub_01j00000000000000000000000"
}
```

**SDK Code**

```python agents_publish_example
import requests

url = "https://api.rasen.ai/v1/agents/agent_id/publish"

headers = {
    "If-Match": "\"draft-17\"",
    "Idempotency-Key": "intent-appointment-001",
    "Rasen-Workspace": "ws_01j00000000000000000000000",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript agents_publish_example
const url = 'https://api.rasen.ai/v1/agents/agent_id/publish';
const options = {
  method: 'POST',
  headers: {
    'If-Match': '"draft-17"',
    'Idempotency-Key': 'intent-appointment-001',
    'Rasen-Workspace': 'ws_01j00000000000000000000000',
    Authorization: 'Bearer <token>'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```ruby agents_publish_example
require 'uri'
require 'net/http'

url = URI("https://api.rasen.ai/v1/agents/agent_id/publish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["If-Match"] = '"draft-17"'
request["Idempotency-Key"] = 'intent-appointment-001'
request["Rasen-Workspace"] = 'ws_01j00000000000000000000000'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java agents_publish_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.rasen.ai/v1/agents/agent_id/publish")
  .header("If-Match", "\"draft-17\"")
  .header("Idempotency-Key", "intent-appointment-001")
  .header("Rasen-Workspace", "ws_01j00000000000000000000000")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php agents_publish_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.rasen.ai/v1/agents/agent_id/publish', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Idempotency-Key' => 'intent-appointment-001',
    'If-Match' => '"draft-17"',
    'Rasen-Workspace' => 'ws_01j00000000000000000000000',
  ],
]);

echo $response->getBody();
```

```csharp agents_publish_example
using RestSharp;

var client = new RestClient("https://api.rasen.ai/v1/agents/agent_id/publish");
var request = new RestRequest(Method.POST);
request.AddHeader("If-Match", "\"draft-17\"");
request.AddHeader("Idempotency-Key", "intent-appointment-001");
request.AddHeader("Rasen-Workspace", "ws_01j00000000000000000000000");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift agents_publish_example
import Foundation

let headers = [
  "If-Match": "\"draft-17\"",
  "Idempotency-Key": "intent-appointment-001",
  "Rasen-Workspace": "ws_01j00000000000000000000000",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.rasen.ai/v1/agents/agent_id/publish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```