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

# Create or update webhook configuration for an application

> Creates a webhook for the current application if one does not exist, otherwise updates the existing webhook URL and/or headers.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/avido/openapi.documented.yml post /v0/webhook
openapi: 3.1.1
info:
  title: Avido API
  description: >-
    Avido's API for LLM usage events, tool calls, trace management, webhook
    validation, and more. See each endpoint's request/response schema for
    details.
  version: 0.1.0
  contact:
    name: Avido Support
    email: support@avidoai.com
    url: https://avidoai.com/support
servers:
  - url: https://api.avidoai.com
    description: Production API
security:
  - ApiKey: []
    ApplicationId: []
paths:
  /v0/webhook:
    post:
      tags:
        - Webhook
      summary: Create or update webhook configuration for an application
      description: >-
        Creates a webhook for the current application if one does not exist,
        otherwise updates the existing webhook URL and/or headers.
      operationId: upsertWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertWebhookRequest'
      responses:
        '201':
          description: Webhook configuration created or updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertWebhookResponse'
        '400':
          description: bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Application not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UpsertWebhookRequest:
      type: object
      properties:
        url:
          type: string
          minLength: 1
          maxLength: 2048
          description: >-
            The URL where webhook events will be sent. Must be https and resolve
            to a public host.
          example: https://example.com/webhook
        headers:
          description: >-
            Custom authentication headers to include in webhook requests. Set to
            null to remove all headers.
          anyOf:
            - $ref: '#/components/schemas/WebhookHeaders'
            - type: 'null'
      required:
        - url
      additionalProperties: false
      title: UpsertWebhookRequest
      description: Request payload for creating or updating a webhook
    UpsertWebhookResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier for the webhook
              example: 123e4567-e89b-12d3-a456-426614174000
            url:
              type: string
              description: The URL where webhook events will be sent.
              example: https://example.com/webhook
            webhookSecret:
              type: string
              description: The secret used to sign webhook payloads
              example: whsec_1234567890abcdef
            applicationId:
              type: string
              description: The ID of the application this webhook belongs to
              example: 123e4567-e89b-12d3-a456-426614174000
            headers:
              description: Custom authentication headers to include in webhook requests
              anyOf:
                - $ref: '#/components/schemas/WebhookHeaders'
                - type: 'null'
            createdAt:
              description: When the webhook was created
              example: '2024-01-01T00:00:00.000Z'
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            modifiedAt:
              description: When the webhook was last modified
              example: '2024-01-01T00:00:00.000Z'
              type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            orgId:
              type: string
              description: The organization ID this webhook belongs to
              example: 123e4567-e89b-12d3-a456-426614174000
          required:
            - id
            - url
            - webhookSecret
            - applicationId
            - createdAt
            - modifiedAt
            - orgId
          additionalProperties: false
          title: Webhook
          description: The created or updated webhook configuration
      required:
        - data
      additionalProperties: false
      title: UpsertWebhookResponse
      description: Response containing the upserted webhook configuration
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message explaining the error.
          example: Resource not found
      required:
        - message
      additionalProperties: false
      title: ErrorResponse
      description: Standard error format for failed API operations.
    ValidationErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message indicating what went wrong.
          example: Invalid request data
        issues:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
              path:
                type: array
                items:
                  type: string
            required:
              - code
              - message
              - path
            additionalProperties: false
          description: Array of detailed validation error objects.
          example:
            - code: invalid_string
              message: Invalid UUID
              path:
                - id
      required:
        - message
        - issues
      additionalProperties: false
      title: ValidationErrorResponse
      description: Details about validation errors in incoming requests.
    WebhookHeaders:
      type: object
      propertyNames:
        type: string
        minLength: 1
        maxLength: 256
        pattern: ^[^\r\n]*$
      additionalProperties:
        type: string
        minLength: 1
        maxLength: 2048
        pattern: ^[^\r\n]*$
      title: WebhookHeaders
      description: >-
        Custom headers to include in webhook requests. Keys are header names,
        values are header values. Maximum 20 headers per webhook.
      example:
        Authorization: Bearer my-secret-token
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your unique Avido API key
    ApplicationId:
      type: apiKey
      in: header
      name: x-application-id
      description: Your unique Avido Application ID

````