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

# Create event

> Create a single event for the authenticated client.



## OpenAPI

````yaml /openapi.json post /client/events
openapi: 3.0.1
info:
  title: MailerPath API
  description: This is the API for MailerPath, a service for managing and sending emails.
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    url: http://www.swagger.io/support
    email: support@swagger.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.38.0
servers:
  - url: https://api.mailerpath.com/api/v1
security: []
paths:
  /client/events:
    post:
      tags:
        - Events
      summary: Create event
      description: Create a single event for the authenticated client.
      parameters:
        - name: sync
          in: query
          description: Process immediately and return processing errors
          schema:
            type: boolean
        - name: processing_mode
          in: query
          description: Set to sync for immediate processing
          schema:
            type: string
      requestBody:
        description: Event payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/internal_api.CreateEventRequest'
        required: true
      responses:
        '200':
          description: 'Duplicate idempotency_key: existing event returned'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/internal_api.APIResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/internal_api.ClientEventResponse'
        '201':
          description: Created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/internal_api.APIResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/internal_api.ClientEventResponse'
        '202':
          description: Accepted for asynchronous processing
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/internal_api.APIResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/internal_api.EventInboxResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api.APIResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api.APIResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    internal_api.CreateEventRequest:
      type: object
      properties:
        action:
          type: string
        amount:
          type: number
        auto_create_contact:
          type: boolean
        email:
          type: string
          description: One of email or uid is required to identify the contact.
          example: user@example.com
        external_id:
          type: string
        feature:
          type: string
        idempotency_key:
          type: string
        metadata:
          type: object
          additionalProperties: true
        plan:
          type: string
        source:
          type: string
        status:
          type: string
        ts:
          type: string
        type:
          type: string
          example: purchase
        uid:
          type: string
          example: usr_abc123
        upgrade:
          type: boolean
    internal_api.APIResponse:
      type: object
      properties:
        data:
          type: object
        errors:
          type: array
          items:
            $ref: '#/components/schemas/internal_api.ValidationError'
        message:
          type: string
          example: Operation successful
        meta:
          type: object
        success:
          type: boolean
          example: true
    internal_api.ClientEventResponse:
      type: object
      properties:
        action:
          type: string
        amount:
          type: number
        client_id:
          type: integer
        contact:
          $ref: '#/components/schemas/internal_api.EventContactInfo'
        contact_id:
          type: integer
        created_at:
          type: string
        external_id:
          type: string
        feature:
          type: string
        id:
          type: integer
        idempotency_key:
          type: string
        metadata:
          type: object
        plan:
          type: string
        process_error:
          type: string
        processed:
          type: boolean
        processed_at:
          type: string
        source:
          type: string
        status:
          type: string
        ts:
          type: string
        type:
          type: string
        upgrade:
          type: boolean
    internal_api.EventInboxResponse:
      type: object
      properties:
        client_id:
          type: integer
        created_at:
          type: string
        event_id:
          type: integer
        id:
          type: integer
        idempotency_key:
          type: string
        payload:
          type: object
          additionalProperties: true
        process_error:
          type: string
        processed_at:
          type: string
        retry_count:
          type: integer
        retryable:
          type: boolean
        status:
          type: string
    internal_api.ValidationError:
      type: object
      properties:
        condition:
          type: string
          example: format
        error:
          type: string
          example: Invalid email format
        key:
          type: string
          example: email
    internal_api.EventContactInfo:
      type: object
      properties:
        email:
          type: string
        first_name:
          type: string
        last_name:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: JWT Bearer token or raw API key via Authorization header
      name: Authorization
      in: header

````