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

# Link Agents to Webhook

> List agents linked to a webhook, or link new agents.

GET: List all agents linked to this webhook
POST: Link one or more agents to this webhook



## OpenAPI

````yaml POST /webhooks/{webhook_id}/agents/
openapi: 3.1.0
info:
  title: Roe AI API
  version: 1.0.0
  description: Complete API documentation for Roe AI platform
servers:
  - url: https://api.roe-ai.com
    description: Production API
security: []
paths:
  /webhooks/{webhook_id}/agents/:
    post:
      tags:
        - webhooks
      description: |-
        List agents linked to a webhook, or link new agents.

        GET: List all agents linked to this webhook
        POST: Link one or more agents to this webhook
      operationId: webhooks_agents_create
      parameters:
        - in: path
          name: webhook_id
          schema:
            type: string
            format: uuid
          required: true
        - name: organization_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Organization ID. This is required for access control. It can be
            provided via query or request body depending on the endpoint.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCreateAgentWebhookRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchCreateAgentWebhook'
          description: ''
      security:
        - jwtAuth: []
      x-codeSamples:
        - lang: Python
          source: |
            import requests

            webhook_id = "your-webhook-id"
            response = requests.post(
                f"https://api.roe-ai.com/webhooks/{webhook_id}/agents/",
                headers={
                    "Authorization": "Bearer YOUR_API_KEY",
                    "Content-Type": "application/json"
                },
                json={"agent_ids": ["agent-id-1", "agent-id-2"]}
            )
            linked = response.json()
            print(f"Linked {len(linked)} agents")
        - lang: TypeScript
          source: |
            const webhookId = "your-webhook-id";
            const response = await fetch(
              `https://api.roe-ai.com/webhooks/${webhookId}/agents/`,
              {
                method: "POST",
                headers: {
                  "Authorization": "Bearer YOUR_API_KEY",
                  "Content-Type": "application/json"
                },
                body: JSON.stringify({
                  agent_ids: ["agent-id-1", "agent-id-2"]
                })
              }
            );
            const linked = await response.json();
            console.log(linked);
        - lang: cURL
          source: >
            curl -X POST
            "https://api.roe-ai.com/webhooks/YOUR_WEBHOOK_ID/agents/" \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{"agent_ids": ["AGENT_ID_1", "AGENT_ID_2"]}'
components:
  schemas:
    BatchCreateAgentWebhookRequest:
      type: object
      description: Serializer for batch linking multiple agents to a webhook.
      properties:
        agent_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of agent IDs to link to this webhook
          minItems: 1
      required:
        - agent_ids
    BatchCreateAgentWebhook:
      type: object
      description: Serializer for batch linking multiple agents to a webhook.
      properties:
        agent_ids:
          type: array
          items:
            type: string
            format: uuid
          description: List of agent IDs to link to this webhook
          minItems: 1
      required:
        - agent_ids
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````