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

# Fire Custom Event

> Fire a custom developer/integration trigger event.

Writes an ``EventOutbox`` row (status ``pending``) that the relay worker
will pick up and match against active automation triggers.

``idempotency_key`` (REQUIRED) — the event is deduplicated per-team.
A repeat call with the same key for the same team returns 200 without
writing a new row.  Different teams with the same key are NOT suppressed.

Returns 202 on a new event, 200 on a duplicate.

Errors flow through the central error pipeline (``jsonapi_error``).



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/hubs/{hub_id}/automations/events
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/teams/{team_id}/hubs/{hub_id}/automations/events:
    post:
      tags:
        - automations
      summary: Fire Custom Event
      description: >-
        Fire a custom developer/integration trigger event.


        Writes an ``EventOutbox`` row (status ``pending``) that the relay worker

        will pick up and match against active automation triggers.


        ``idempotency_key`` (REQUIRED) — the event is deduplicated per-team.

        A repeat call with the same key for the same team returns 200 without

        writing a new row.  Different teams with the same key are NOT
        suppressed.


        Returns 202 on a new event, 200 on a duplicate.


        Errors flow through the central error pipeline (``jsonapi_error``).
      operationId: >-
        automations.post_automations_post_teams_by_team_id_hubs_by_hub_id_automations_events
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/CustomEventBody'
        required: true
      responses:
        '202':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/CustomEventAcceptedResponse'
          description: Successful Response
        '400':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Bad request
        '401':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not authenticated
        '403':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Forbidden
        '404':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not found
        '409':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Status conflict
        '415':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Unsupported media type (requires application/vnd.api+json)
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Graph validation error
      security:
        - HTTPBearer: []
components:
  schemas:
    CustomEventBody:
      additionalProperties: false
      properties:
        event_type:
          maxLength: 100
          minLength: 1
          title: Event Type
          type: string
        idempotency_key:
          maxLength: 128
          minLength: 1
          title: Idempotency Key
          type: string
        payload:
          additionalProperties: true
          title: Payload
          type: object
        team_contact_id:
          minLength: 1
          title: Team Contact Id
          type: string
      required:
        - event_type
        - team_contact_id
        - idempotency_key
      title: CustomEventBody
      type: object
    CustomEventAcceptedResponse:
      additionalProperties: false
      description: |-
        Top-level meta-only response for POST /automations/events.

        JSON:API allows a top-level ``meta`` without ``data`` for non-resource
        responses (§ 7.1 "Top Level").  This is used for the custom-event fire
        endpoint which writes an outbox row but does not return a resource.
      properties:
        meta:
          $ref: '#/components/schemas/CustomEventAcceptedMeta'
      required:
        - meta
      title: CustomEventAcceptedResponse
      type: object
    JsonApiErrorResponse:
      description: Error JSON:API response.
      properties:
        errors:
          items:
            $ref: '#/components/schemas/JsonApiError'
          title: Errors
          type: array
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - errors
      title: JsonApiErrorResponse
      type: object
    CustomEventAcceptedMeta:
      additionalProperties: false
      description: >-
        ``meta`` payload for the POST /automations/events response.


        Returned on both 202 (new event) and 200 (duplicate/deduped) responses.

        ``accepted`` is ``True`` when the event was newly written; ``False``
        when

        the idempotency_key was already present (dedup).
      properties:
        accepted:
          title: Accepted
          type: boolean
        event_type:
          title: Event Type
          type: string
        idempotency_key:
          title: Idempotency Key
          type: string
      required:
        - event_type
        - idempotency_key
        - accepted
      title: CustomEventAcceptedMeta
      type: object
    JsonApiError:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        source:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source
        status:
          title: Status
          type: string
        title:
          title: Title
          type: string
      required:
        - status
        - title
      title: JsonApiError
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````