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

# Create webhook

> Register events webhook.



## OpenAPI

````yaml /openapi-public.yaml post /events/webhooks
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
  - name: Secrets
  - name: Events
  - name: Webhooks
paths:
  /events/webhooks:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: Register events webhook.
      operationId: postEventsWebhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCreate'
      responses:
        '201':
          description: Successfully created webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCreation'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 400
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                invalidEventType:
                  summary: An unrecognized webhook event type was supplied
                  value:
                    code: 400
                    message: 'Invalid event type: invalid.event'
                signingSecretTooShort:
                  summary: The webhook signing secret is shorter than 32 characters
                  value:
                    code: 400
                    message: Webhook secret must be at least 32 characters long
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 401
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                missingAuthentication:
                  summary: No supported authentication header was supplied
                  value:
                    code: 401
                    message: authorization header is missing
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 403
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                teamBanned:
                  summary: The team is banned at authentication
                  value:
                    code: 403
                    message: team is banned
                teamBlocked:
                  summary: >-
                    The authenticated team is blocked. The message may append a
                    reason
                  value:
                    code: 403
                    message: team is blocked
        '404':
          description: Not found
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 404
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                resourceNotFound:
                  summary: The backend cannot find the requested resource
                  value:
                    code: 404
                    message: Webhook not found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 500
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                backendError:
                  summary: The backend failed
                  value:
                    code: 500
                    message: Failed to create webhook
        '503':
          description: Service unavailable
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 503
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                backendUnavailable:
                  summary: The backend is not configured
                  value:
                    code: 503
                    message: Webhooks are not available
        '504':
          description: Backend timeout
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 504
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                backendDeadlineExceeded:
                  summary: The backend deadline was exceeded
                  value:
                    code: 504
                    message: Failed to create webhook
      security:
        - ApiKeyAuth: []
components:
  schemas:
    WebhookCreate:
      description: Configuration for registering new webhooks
      required:
        - name
        - url
        - events
        - signatureSecret
      properties:
        name:
          type: string
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            type: string
            enum:
              - sandbox.lifecycle.created
              - sandbox.lifecycle.killed
              - sandbox.lifecycle.paused
              - sandbox.lifecycle.resumed
              - sandbox.lifecycle.updated
              - sandbox.lifecycle.checkpointed
          example:
            - sandbox.lifecycle.created
        enabled:
          type: boolean
          default: true
        signatureSecret:
          type: string
          description: Secret used to sign the webhook payloads
          minLength: 32
          example: replace-with-your-random-signing-secret
      type: object
    WebhookCreation:
      description: Webhook creation response
      required:
        - id
        - name
        - createdAt
        - teamId
        - url
        - enabled
        - events
      properties:
        id:
          type: string
          description: Webhook unique identifier
        name:
          type: string
          description: Webhook user friendly name
        createdAt:
          type: string
          format: date-time
          description: Time when the template was created
        teamId:
          type: string
          description: Unique identifier for the team
        url:
          type: string
          format: uri
        enabled:
          type: boolean
        events:
          type: array
          items:
            type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````