---
title: "Create Event Source"
method: POST
path: "/api/v1/event-sources"
tags: ["event-sources"]
---

# Create Event Source

`POST /api/v1/event-sources`

Creates an event source.

Args:
    event_source: EventSource to register.

Returns:
    The created event source.

Raises:
    ValueError: If the plugin for an event source is not a valid event
        source plugin.

## Request body

- EventSourceRequest — BaseModel for all event sources.
  - `user` string, uuid, required
  - `workspace` string, uuid, required
  - `name` string, required
  - `flavor` string, required
  - `plugin_subtype` 'webhook' | 'pipeline_run', required — All possible types of Plugins.
  - `description` string
  - `configuration` object, required

## Response `200`

Successful Response

- EventSourceResponse — Response model for event sources.
  - `body` EventSourceResponseBody — ResponseBody for event sources.
    - `created` string, date-time, required
    - `updated` string, date-time, required
    - `user` UserResponse — Response model for user and service accounts. This returns the activation_token that is required for the user-invitation-flow of the frontend. The email is returned optionally as well for use by the analytics on the client-side.
      - `body` UserResponseBody — Response body for users.
        - `created` string, date-time, required
        - `updated` string, date-time, required
        - `active` boolean
        - `activation_token` string, nullable
        - `full_name` string
        - `email_opted_in` boolean, nullable — `null` if not answered, `true` if agreed, `false` if skipped.
        - `is_service_account` boolean, required
        - `is_admin` boolean, required
      - `metadata` UserResponseMetadata — Response metadata for users.
        - `email` string, nullable
        - `external_user_id` string, uuid, nullable
        - `user_metadata` object
      - `resources` UserResponseResources — Class for all resource models associated with the user entity.
      - `id` string, uuid, required
      - `permission_denied` boolean
      - `name` string, required
    - `flavor` string, required
    - `plugin_subtype` 'webhook' | 'pipeline_run', required — All possible types of Plugins.
    - `is_active` boolean, required
  - `metadata` EventSourceResponseMetadata — Response metadata for event sources.
    - `workspace` WorkspaceResponse, required — Response model for workspaces.
      - `body` WorkspaceResponseBody — Response body for workspaces.
        - `created` string, date-time, required
        - `updated` string, date-time, required
      - `metadata` WorkspaceResponseMetadata — Response metadata for workspaces.
        - `description` string
      - `resources` WorkspaceResponseResources — Class for all resource models associated with the workspace entity.
      - `id` string, uuid, required
      - `permission_denied` boolean
      - `name` string, required
    - `description` string
    - `configuration` object, required
  - `resources` EventSourceResponseResources — Class for all resource models associated with the code repository entity.
    - `triggers` PageTriggerResponse, required
      - `index` integer, required
      - `max_size` integer, required
      - `total_pages` integer, required
      - `total` integer, required
      - `items` TriggerResponse[], required
        - `body` TriggerResponseBody — Response body for triggers.
          - `created` string, date-time, required
          - `updated` string, date-time, required
          - `user` UserResponse — Response model for user and service accounts. This returns the activation_token that is required for the user-invitation-flow of the frontend. The email is returned optionally as well for use by the analytics on the client-side.
            - `body` UserResponseBody — Response body for users.
              - …
            - `metadata` UserResponseMetadata — Response metadata for users.
              - …
            - `resources` UserResponseResources — Class for all resource models associated with the user entity.
            - `id` string, uuid, required
            - `permission_denied` boolean
            - `name` string, required
          - `action_flavor` string, required
          - `action_subtype` string, required
          - `event_source_flavor` string, nullable
          - `event_source_subtype` string, nullable
          - `is_active` boolean, required
        - `metadata` TriggerResponseMetadata — Response metadata for triggers.
          - `workspace` WorkspaceResponse, required — Response model for workspaces.
            - `body` WorkspaceResponseBody — Response body for workspaces.
              - …
            - `metadata` WorkspaceResponseMetadata — Response metadata for workspaces.
              - …
            - `resources` WorkspaceResponseResources — Class for all resource models associated with the workspace entity.
            - `id` string, uuid, required
            - `permission_denied` boolean
            - `name` string, required
          - `description` string
          - `event_filter` object, nullable
          - `schedule` Schedule — Class for defining a pipeline schedule. Attributes: name: Optional name to give to the schedule. If not set, a default name will be generated based on the pipeline name and the current date and time. cron_expression: Cron expression for the pipeline schedule. If a value for this is set it takes precedence over the start time + interval. start_time: datetime object to indicate when to start the schedule. end_time: datetime object to indicate when to end the schedule. interval_second: datetime timedelta indicating the seconds between two recurring runs for a periodic schedule. catchup: Whether the recurring run should catch up if behind schedule. For example, if the recurring run is paused for a while and re-enabled afterward. If catchup=True, the scheduler will catch up on (backfill) each missed interval. Otherwise, it only schedules the latest interval if more than one interval is ready to be scheduled. Usually, if your pipeline handles backfill internally, you should turn catchup off to avoid duplicate backfill. run_once_start_time: datetime object to indicate when to run the pipeline once. This is useful for one-off runs.
            - `name` string, nullable
            - `cron_expression` string, nullable
            - `start_time` string, date-time, nullable
            - `end_time` string, date-time, nullable
            - `interval_second` string, duration, nullable
            - `catchup` boolean
            - `run_once_start_time` string, date-time, nullable
        - `resources` TriggerResponseResources — Class for all resource models associated with the trigger entity.
          - `action` ActionResponse, required — Response model for actions.
            - `body` ActionResponseBody — Response body for actions.
              - …
            - `metadata` ActionResponseMetadata — Response metadata for actions.
              - …
            - `resources` ActionResponseResources — Class for all resource models associated with the action entity.
              - …
            - `id` string, uuid, required
            - `permission_denied` boolean
            - `name` string, required
          - `event_source` EventSourceResponse — recursive
          - `executions` PageTriggerExecutionResponse, required
            - `index` integer, required
            - `max_size` integer, required
            - `total_pages` integer, required
            - `total` integer, required
            - `items` TriggerExecutionResponse[], required
              - …
        - `id` string, uuid, required
        - `permission_denied` boolean
        - `name` string, required
  - `id` string, uuid, required
  - `permission_denied` boolean
  - `name` string, required

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `409` — Conflict
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/zenml-io/apis/zenml-2.md) · [All operations](https://skmtc.net/zenml-io/apis/zenml-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zenml-io/zenml-2/versions/febb01b8bce3/schema)
