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

# Create Webhook Trigger

> Wire a webhook trigger in one call.

Registers the source's signature-verification key (github/slack) for the agent and
returns the ready-to-paste forward webhook URL plus the signing secret (shown once).
The webhook then flows through the existing /agents/forward ingress, which verifies
the signature against this key. Bundles the existing key-create + URL composition so
a UI (or a curl) can set up a trigger without two steps.



## OpenAPI

````yaml https://agentex.dev-sgp.scale.com/openapi.json post /agent_api_keys/webhook-trigger
openapi: 3.1.0
info:
  title: Agentex API
  version: 0.1.0
servers: []
security: []
paths:
  /agent_api_keys/webhook-trigger:
    post:
      tags:
        - Agent APIKeys
      summary: Create Webhook Trigger
      description: >-
        Wire a webhook trigger in one call.


        Registers the source's signature-verification key (github/slack) for the
        agent and

        returns the ready-to-paste forward webhook URL plus the signing secret
        (shown once).

        The webhook then flows through the existing /agents/forward ingress,
        which verifies

        the signature against this key. Bundles the existing key-create + URL
        composition so

        a UI (or a curl) can set up a trigger without two steps.
      operationId: create_webhook_trigger_agent_api_keys_webhook_trigger_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookTriggerRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateWebhookTriggerResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateWebhookTriggerRequest:
      properties:
        agent_name:
          type: string
          title: Agent Name
          description: The agent the webhook drives.
        source:
          $ref: '#/components/schemas/AgentAPIKeyType'
          description: Webhook source whose signature is verified (github or slack).
          default: github
        name:
          type: string
          title: Name
          description: >-
            Signature-lookup key: the repo full_name (github) or api_app_id
            (slack) that the forward ingress matches the incoming webhook
            against.
        forward_path:
          type: string
          title: Forward Path
          description: >-
            Subpath the agent's own route handles, e.g. 'github-pr/<config-id>'.
            Appended to /agents/forward/name/{agent_name}/ to form the webhook
            URL.
        secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Secret
          description: >-
            Signing secret. For GitHub, omit to generate one, or provide an
            existing webhook secret. For Slack, this is required and must be the
            Slack app's Signing Secret.
        base_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Url
          description: >-
            Optional public agentex base URL for the returned webhook_url;
            defaults to the AGENTEX_PUBLIC_URL env var.
      type: object
      required:
        - agent_name
        - name
        - forward_path
      title: CreateWebhookTriggerRequest
      description: >-
        One-call setup for a webhook trigger: register the source's signature
        key and

        get back the ready-to-paste forward webhook URL.
    CreateWebhookTriggerResponse:
      properties:
        key_id:
          type: string
          title: Key Id
          description: The created agent API key id.
        agent_name:
          type: string
          title: Agent Name
          description: The agent the webhook drives.
        source:
          $ref: '#/components/schemas/AgentAPIKeyType'
          description: Webhook source (github or slack).
        name:
          type: string
          title: Name
          description: Signature-lookup key (repo full_name / api_app_id).
        secret:
          type: string
          title: Secret
          description: >-
            The signing secret — shown once; paste into the source's webhook
            config.
        webhook_path:
          type: string
          title: Webhook Path
          description: The forward path to POST webhooks to.
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Url
          description: >-
            Full webhook URL to paste into the source (None if no base URL
            configured).
      type: object
      required:
        - key_id
        - agent_name
        - source
        - name
        - secret
        - webhook_path
      title: CreateWebhookTriggerResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentAPIKeyType:
      type: string
      enum:
        - internal
        - external
        - github
        - slack
      title: AgentAPIKeyType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````