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

# Subscribe to email lists

Subscribe a contact to one or more email lists. This is a public endpoint that doesn't require authentication.

**Important:** This endpoint subscribes contacts to **public lists** only. To add a contact to a private list, use the authenticated `/api/lists.subscribe` endpoint with a bearer token. A valid `email_hmac` in the contact object only lets the contact confirm a pending double opt-in on a private list: it never adds them to one, nor back to one they left.

If the list has double opt-in enabled, a confirmation email will be sent.

## OpenAPI

````yaml /openapi.json post /subscribe
openapi: 3.0.3
info:
  title: Notifuse API
  description: API for Notifuse - a transactional email and newsletter management platform
  version: 1.0.0
  contact:
    name: Notifuse Support
    url: https://www.notifuse.com/support
    email: hello@notifuse.com
  license:
    name: BUSL-1.1
    url: https://github.com/Notifuse/notifuse/blob/main/LICENSE
servers:
  - url: https://{notifuseDomain}
    description: Customer-specific Notifuse API server
    variables:
      notifuseDomain:
        description: Your unique Notifuse domain
        default: demo.notifuse.com
security: []
paths:
  /subscribe:
    post:
      summary: Subscribe to email lists
      description: >
        Subscribe a contact to one or more email lists. This is a public
        endpoint that doesn't require authentication.


        **Important:** This endpoint subscribes contacts to **public lists**
        only. To add a contact to a private list, use the authenticated
        `/api/lists.subscribe` endpoint with a bearer token. A valid
        `email_hmac` in the contact object only lets the contact confirm a
        pending double opt-in on a private list: it never adds them to one, nor
        back to one they left.


        If the list has double opt-in enabled, a confirmation email will be
        sent.
      operationId: subscribeToLists
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SubscribeToListsRequest"
      responses:
        "200":
          description: Subscription successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the subscription was successful
                    example: true
        "400":
          description: Bad request - validation failed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              examples:
                missingWorkspaceId:
                  value:
                    error: workspace_id is required
                invalidEmail:
                  value:
                    error: "invalid contact: invalid email format"
                missingListIds:
                  value:
                    error: list_ids is required
                listNotPublic:
                  value:
                    error: list is not public
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                error: Failed to subscribe to lists
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
      required:
        - error
    SubscribeToListsRequest:
      type: object
      required:
        - workspace_id
        - contact
        - list_ids
      properties:
        workspace_id:
          type: string
          description: The ID of the workspace
          example: ws_1234567890
        contact:
          $ref: "#/components/schemas/SubscriptionContact"
        list_ids:
          type: array
          description: Array of list IDs to subscribe the contact to
          items:
            type: string
          example:
            - newsletter
            - product_updates
          minItems: 1
    SubscriptionContact:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          description: Email address of the contact
          example: user@example.com
        email_hmac:
          type: string
          description: HMAC of the email for authenticated subscription (optional)
          example: a1b2c3d4e5f6...
        external_id:
          type: string
          nullable: true
          description: Optional identifier for the contact in your own system. Not unique
            — contacts are identified by email address.
          example: user_12345
        timezone:
          type: string
          nullable: true
          description: Timezone of the contact
          example: America/New_York
        language:
          type: string
          nullable: true
          description: Preferred language of the contact
          example: en-US
        first_name:
          type: string
          nullable: true
          description: First name of the contact
          example: John
        last_name:
          type: string
          nullable: true
          description: Last name of the contact
          example: Doe
        full_name:
          type: string
          nullable: true
          description: Full name of the contact (for systems that don't have separate
            first/last names)
          example: John Doe
        phone:
          type: string
          nullable: true
          description: Phone number of the contact
          example: "+15551234567"
        address_line_1:
          type: string
          nullable: true
          description: First line of address
          example: 123 Main St
        address_line_2:
          type: string
          nullable: true
          description: Second line of address
          example: Apt 4B
        country:
          type: string
          nullable: true
          description: Country of the contact
          example: US
        postcode:
          type: string
          nullable: true
          description: Postal code
          example: "10001"
        state:
          type: string
          nullable: true
          description: State or province
          example: NY
        job_title:
          type: string
          nullable: true
          description: Job title of the contact
          example: Software Engineer
        tracking_opens_consent:
          type: string
          enum:
            - granted
            - denied
          description: >
            The visitor's choice about open tracking, for example from a
            checkbox on your form.

            Recorded with source `subscribe_form` on a public request.
        tracking_clicks_consent:
          type: string
          enum:
            - granted
            - denied
          description: The visitor's choice about click tracking, recorded like
            `tracking_opens_consent`.
        custom_string_1:
          type: string
          nullable: true
          description: Custom string field 1
          example: Premium tier
        custom_string_2:
          type: string
          nullable: true
          description: Custom string field 2
        custom_string_3:
          type: string
          nullable: true
          description: Custom string field 3
        custom_string_4:
          type: string
          nullable: true
          description: Custom string field 4
        custom_string_5:
          type: string
          nullable: true
          description: Custom string field 5
        custom_number_1:
          type: number
          format: float
          nullable: true
          description: Custom number field 1
          example: 42
        custom_number_2:
          type: number
          format: float
          nullable: true
          description: Custom number field 2
        custom_number_3:
          type: number
          format: float
          nullable: true
          description: Custom number field 3
        custom_number_4:
          type: number
          format: float
          nullable: true
          description: Custom number field 4
        custom_number_5:
          type: number
          format: float
          nullable: true
          description: Custom number field 5
        custom_datetime_1:
          type: string
          format: date-time
          nullable: true
          description: Custom datetime field 1
          example: 2023-06-01T09:00:00Z
        custom_datetime_2:
          type: string
          format: date-time
          nullable: true
          description: Custom datetime field 2
        custom_datetime_3:
          type: string
          format: date-time
          nullable: true
          description: Custom datetime field 3
        custom_datetime_4:
          type: string
          format: date-time
          nullable: true
          description: Custom datetime field 4
        custom_datetime_5:
          type: string
          format: date-time
          nullable: true
          description: Custom datetime field 5
        custom_json_1:
          type: object
          nullable: true
          description: Custom JSON field 1
          example:
            preferences:
              theme: dark
              notifications: true
        custom_json_2:
          type: object
          nullable: true
          description: Custom JSON field 2
        custom_json_3:
          type: object
          nullable: true
          description: Custom JSON field 3
        custom_json_4:
          type: object
          nullable: true
          description: Custom JSON field 4
        custom_json_5:
          type: object
          nullable: true
          description: Custom JSON field 5
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API token for authentication
````
