> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ravan.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign Cal.com Account to Agent

> Links or unlinks an org-level Cal.com account to an agent. The request is rejected if the agent already has a private agent-level Cal.com API key.

### Authorizations

<ParamField header="Authorization" type="string" required>
  Your JWT access token. Pass it as a Bearer token in the `Authorization` header. Example: `Authorization: Bearer <token>`.
</ParamField>

***

### Path Parameters

<ParamField path="agent_id" type="string" required>
  The agent UUID to link or unlink from an org-level Cal.com account.
</ParamField>

***

### Query Parameters

<ParamField query="org_id" type="string">
  Optional fallback organization ID. It is used only when the JWT claims do not already include the org context.
</ParamField>

***

### Body

<ParamField body="calcom_account_id" type="string">
  The org-level Cal.com account ID to link to the agent. Send `null` to unlink the current account from the agent.
</ParamField>

***

### Response

<ResponseField name="success" type="boolean">
  Whether the request succeeded.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status message.
</ResponseField>

<ResponseField name="data" type="object">
  Updated agent Cal.com account assignment.

  <Expandable title="data">
    <ResponseField name="agent_id" type="string">
      Agent UUID.
    </ResponseField>

    <ResponseField name="agent_name" type="string">
      Agent display name.
    </ResponseField>

    <ResponseField name="calcom_account_id" type="string">
      Linked Cal.com account UUID, or `null` when unlinked.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": <boolean>,
    "message": "Agent Cal.com account updated",
    "data": {
      "agent_id": "<string>",
      "agent_name": "<string>",
      "calcom_account_id": "<string>"
    }
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 400 theme={null}
  {
    "success": false,
    "message": "<string>",
    "code": "INVALID_REQUEST"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 401 theme={null}
  {
    "success": false,
    "message": "<string>"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 404 theme={null}
  {
    "success": false,
    "message": "<string>",
    "code": "NOT_FOUND"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 409 theme={null}
  {
    "success": false,
    "message": "<string>",
    "code": "CONFLICT"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 500 theme={null}
  {
    "success": false,
    "message": "<string>",
    "code": "INTERNAL_ERROR"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml PUT /api/v1/calcom/agents/{agent_id}/account
openapi: 3.0.1
info:
  title: Agni API
  version: 1.0.0
  description: >-
    Agni API for managing agents, tools, widget settings, telephony, and
    integrations.
servers:
  - url: https://api.ravan.ai
security:
  - X-Api-Key: []
tags:
  - name: AgentService
  - name: AgentToolService
  - name: WidgetSettingsService
  - name: PhoneService
  - name: AppointmentService
  - name: GHLService
  - name: CalComService
  - name: CampaignService
  - name: ContactService
  - name: CallingService
  - name: RAGService
  - name: ModelService
  - name: HealthService
paths:
  /api/v1/calcom/agents/{agent_id}/account:
    put:
      tags:
        - CalComService
      summary: Assign Cal.com Account to Agent
      operationId: AssignAgentCalcomAccount
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
          description: Agent UUID
        - name: org_id
          in: query
          schema:
            type: string
          description: Fallback organization ID used only when not present in JWT claims
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignAgentCalcomAccountRequest'
            example:
              calcom_account_id: <string>
      responses:
        '200':
          description: Agent Cal.com account updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCalcomAccountResponse'
              example:
                success: true
                message: Agent Cal.com account updated
                data:
                  agent_id: <string>
                  agent_name: <string>
                  calcom_account_id: <string>
        '400':
          description: Missing agent_id or invalid body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: <string>
                code: INVALID_REQUEST
        '401':
          description: Missing or invalid JWT
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
              example:
                success: false
                message: <string>
        '404':
          description: Cal.com account or agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: <string>
                code: NOT_FOUND
        '409':
          description: Agent already has a private Cal.com key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: <string>
                code: CONFLICT
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: <string>
                code: INTERNAL_ERROR
      security:
        - BearerAuth: []
components:
  schemas:
    AssignAgentCalcomAccountRequest:
      type: object
      properties:
        calcom_account_id:
          type: string
          nullable: true
          description: Org-level Cal.com account UUID, or null to unlink
      example:
        calcom_account_id: <string>
    AgentCalcomAccountResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          $ref: '#/components/schemas/AgentCalcomAccountAssignment'
      example:
        success: true
        message: Agent Cal.com account updated
        data:
          agent_id: <string>
          agent_name: <string>
          calcom_account_id: <string>
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        code:
          type: string
    UnauthorizedResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
      example:
        success: false
        message: <string>
    AgentCalcomAccountAssignment:
      type: object
      properties:
        agent_id:
          type: string
        agent_name:
          type: string
        calcom_account_id:
          type: string
          nullable: true
      example:
        agent_id: <string>
        agent_name: <string>
        calcom_account_id: <string>
  securitySchemes:
    X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````