openapi: 3.1.0
info:
  title: SendX REST API
  version: 1.0.0
  description: >
    # SendX REST API Documentation


    ## 🚀 Introduction


    The SendX API is organized around REST principles. Our API has predictable
    resource-oriented URLs, accepts JSON-encoded request bodies, returns
    JSON-encoded responses, and uses standard HTTP response codes,
    authentication, and verbs.


    **Key Features:**

    - 🔒 **Security**: Team-based authentication with optional member-level
    access

    - 🎯 **Resource-Oriented**: RESTful design with clear resource boundaries

    - 📊 **Rich Data Models**: Three-layer model system (Input/Output/Internal)

    - 🔗 **Relationships**: Automatic prefix handling for resource relationships

    - 📈 **Scalable**: Built for high-volume email marketing operations


    ## 🏗️ Architecture Overview


    SendX uses a three-layer model architecture:


    1. **Input Models** (`RestE*`): For API requests

    2. **Output Models** (`RestR*`): For API responses with prefixed IDs

    3. **Internal Models**: Core business logic (not exposed in API)


    ## 🔐 Security & Authentication


    SendX uses API key authentication:


    ### Team API Key

    ```http

    X-Team-ApiKey: YOUR_TEAM_API_KEY

    ```

    - **Required for all requests**

    - Team-level access to resources

    - Available in SendX Settings → Team API Key


    ## 🆔 Encrypted ID System


    SendX uses encrypted IDs for security and better developer experience:


    - **Internal IDs**: Sequential integers (not exposed)

    - **Encrypted IDs**: 22-character alphanumeric strings

    - **Prefixed IDs**: Resource-type prefixes in API responses
    (`contact_<22-char-id>`)


    ### ID Format


    **All resource IDs follow this pattern:**

    ```

    <resource_prefix>_<22_character_alphanumeric_string>

    ```


    **Example:**

    ```json

    {
      "id": "contact_BnKjkbBBS500CoBCP0oChQ",
      "lists": ["list_OcuxJHdiAvujmwQVJfd3ss", "list_0tOFLp5RgV7s3LNiHrjGYs"],
      "tags": ["tag_UhsDkjL772Qbj5lWtT62VK", "tag_fL7t9lsnZ9swvx2HrtQ9wM"]
    }

    ```


    ## 📚 Resource Prefixes


    | Resource | Prefix | Example |

    |----------|--------|---------|

    | Contact | `contact_` | `contact_BnKjkbBBS500CoBCP0oChQ` |

    | Campaign | `campaign_` | `campaign_LUE9BTxmksSmqHWbh96zsn` |

    | List | `list_` | `list_OcuxJHdiAvujmwQVJfd3ss` |

    | Tag | `tag_` | `tag_UhsDkjL772Qbj5lWtT62VK` |

    | Sender | `sender_` | `sender_4vK3WFhMgvOwUNyaL4QxCD` |

    | Template | `template_` | `template_f3lJvTEhSjKGVb5Lwc5SWS` |

    | Custom Field | `custom_field_` | `field_MnuqBAG2NPLm7PZMWbjQxt` |

    | Webhook | `webhook_` | `webhook_9l154iiXlZoPo7vngmamee` |

    | Post | `post_` | `post_XyZ123aBc456DeF789GhI` |

    | Post Category | `post_category_` | `post_category_YzS1wOU20yw87UUHKxMzwn`
    |

    | Post Tag | `post_tag_` | `post_tag_123XyZ456AbC` |

    | Member | `member_` | `member_JkL012MnO345PqR678` |

    | Domain | `domain_` | `domain_504` |


    ## 🎯 Best Practices


    ### Error Handling

    - **Always check status codes**: 2xx = success, 4xx = client error, 5xx =
    server error

    - **Read error messages**: Descriptive messages help debug issues

    - **Handle rate limits**: Respect API rate limits for optimal performance


    ### Data Validation

    - **Email format**: Must be valid email addresses

    - **Required fields**: Check documentation for mandatory fields

    - **Field lengths**: Respect maximum length constraints


    ### Performance

    - **Pagination**: Use offset/limit for large datasets

    - **Batch operations**: Process multiple items when supported

    - **Caching**: Cache responses when appropriate


    ## 🛠️ SDKs & Integration


    Official SDKs available for:

    - [Golang](https://github.com/sendx/sendx-go-sdk)

    - [Python](https://github.com/sendx/sendx-python-sdk)

    - [Ruby](https://github.com/sendx/sendx-ruby-sdk)

    - [Java](https://github.com/sendx/sendx-java-sdk)

    - [PHP](https://github.com/sendx/sendx-php-sdk)

    - [JavaScript](https://github.com/sendx/sendx-javascript-sdk)


    ## 📞 Support


    Need help? Contact us:

    - 💬 **Website Chat**: Available on sendx.io

    - 📧 **Email**: hello@sendx.io

    - 📚 **Documentation**: Full guides at help.sendx.io


    ---


    **API Endpoint:** `https://api.sendx.io/api/v1/rest`


    [<img src="https://run.pstmn.io/button.svg" alt="Run In Postman"
    style="width: 128px; height:
    32px;">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e)
  contact:
    name: SendX API Support
    email: hello@sendx.io
    url: https://sendx.io
  license:
    name: Proprietary
    url: https://sendx.io/terms
servers:
  - url: https://api.sendx.io/api/v1/rest
    description: Production server
x-mcp:
  enabled: true
security:
  - TeamApiKey: []
tags:
  - name: Contact
    description: >
      **Contact Management**


      Contacts are the core of your SendX account. They represent your
      customers, leads, or any person you wish to communicate with through
      marketing campaigns.


      **Key Features:**

      - ✅ Create, read, update, and delete contacts

      - 🏷️ Associate with lists and tags

      - 📝 Store custom field data

      - 📊 Track engagement metrics

      - 🔒 Team-based access control


      **Business Rules:**

      - Email addresses must be unique within a team

      - Custom fields are created automatically if they don't exist

      - Tags are created automatically when assigned

      - Soft deletes preserve historical data
  - name: Campaign
    description: >
      **Campaign Management**


      Campaigns allow you to send targeted email marketing messages to your
      contacts.


      **Key Features:**

      - 📧 Create and manage email campaigns

      - 🎯 Target specific lists and segments

      - 📊 Track campaign performance

      - ⏰ Schedule campaigns for future delivery

      - 🔄 A/B testing support
  - name: List
    description: |
      **List Management**

      Lists help you organize contacts into groups for targeted messaging.

      **Key Features:**
      - 📁 Create and manage contact lists
      - 👥 Bulk operations on list members
      - 🔗 Associate with campaigns
      - 📊 Track list growth metrics
  - name: Tag
    description: |
      **Tag Management**

      Tags provide flexible contact categorization for advanced segmentation.

      **Key Features:**
      - 🏷️ Create and manage tags
      - 🔍 Advanced contact filtering
      - 🎯 Behavior-based tagging
      - 📊 Tag-based analytics
  - name: Sender
    description: |
      **Sender Management**

      Manage verified sender addresses for your campaigns.

      **Key Features:**
      - ✉️ Add and verify sender addresses
      - 🔐 Domain authentication
      - 📧 Default sender settings
  - name: Template
    description: |
      **Email Template Management**

      Create and manage reusable email templates for campaigns.

      **Key Features:**
      - 🎨 HTML and text templates
      - 🔄 Reusable across campaigns
      - 📱 Mobile-responsive designs
      - 🏷️ Personalization support
  - name: Custom Field
    description: |
      **Custom Field Management**

      Define custom data fields for storing additional contact information.

      **Key Features:**
      - 📝 Create custom data fields
      - 🔢 Support for various data types
      - 📊 Use in segmentation
      - 🔄 Bulk updates
  - name: Webhook
    description: |
      **Webhook Management**

      Configure webhooks to receive real-time event notifications.

      **Key Features:**
      - 🔔 Real-time event notifications
      - 🎯 Event filtering
      - 🔒 Secure payload delivery
      - 📊 Delivery status tracking
  - name: Email Sending
    description: |
      **Email Sending APIs**

      Send transactional and marketing emails programmatically.

      **Key Features:**
      - 📧 Send individual emails
      - 🎨 Template-based sending
      - 📎 Attachment support
      - 🔄 Personalization variables
  - name: Events
    description: |
      **Event Tracking**

      Track custom events and revenue data for advanced analytics.

      **Key Features:**
      - 📊 Custom event tracking
      - 💰 Revenue attribution
      - 🔗 Integration with analytics
      - 📈 Conversion tracking
  - name: Tracking
    description: |
      **Contact Tracking APIs**

      Legacy tracking endpoints for backward compatibility.

      **Key Features:**
      - 👤 Identify contacts
      - 🏷️ Track contact behavior
      - 📊 Update contact properties
      - ⚠️ Consider using newer endpoints
  - name: Report
    description: |
      **Reporting APIs**

      Access detailed reports and analytics data.

      **Key Features:**
      - 📊 Campaign performance metrics
      - 📈 Engagement analytics
      - 💰 Revenue reports
      - 📉 Trend analysis
  - name: Post
    description: |
      **Blog Post Management**

      Manage blog posts and content for your marketing efforts.

      **Key Features:**
      - 📝 Create and manage posts
      - 🏷️ Categorize with tags
      - 📁 Organize by categories
      - 🔍 SEO optimization
  - name: Post Category
    description: |
      **Post Category Management**

      Organize blog posts into categories.

      **Key Features:**
      - 📁 Create categories
      - 🔗 Associate posts
      - 📊 Category analytics
  - name: Post Tag
    description: |
      **Post Tag Management**

      Tag blog posts for better organization and discovery.

      **Key Features:**
      - 🏷️ Create post tags
      - 🔍 Improve discoverability
      - 📊 Tag-based filtering
  - name: Team Member
    description: |
      **Team Member Information**

      Access team member details (read-only).

      **Key Features:**
      - 👤 View member profiles
      - 📧 Access member information
      - 🔒 Read-only access
paths:
  /send/email:
    post:
      tags:
        - Email Sending
      summary: Send transactional email
      description: >
        Sends transactional emails to specified recipients with support for
        personalization, attachments, and tracking.


        The API validates the request synchronously and returns **202 Accepted**
        when the email is queued. Actual sending and personalization happen
        asynchronously in a worker. A 202 does not guarantee delivery; it means
        the request was accepted and queued. Per-recipient success/failure is
        not returned in the API response.


        **Optional headers:** `List-Unsubscribe` (passed through for
        list-unsubscribe), `X-SendPost-Mock-Email: true` (mock send, if
        supported).
      operationId: sendEmail
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/XEmailMessage'
      responses:
        '202':
          description: ✅ Email queued for delivery
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionalEmailQueueResponse'
              example:
                status: success
                message: Email queued for delivery
        '400':
          description: >-
            ❌ Bad Request - Validation failed (recipients, from, domain, add-on,
            invalid to)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                no_recipients:
                  summary: No recipients specified
                  value:
                    status: error
                    message: no recipients specified
                from_required:
                  summary: From email missing
                  value:
                    status: error
                    message: from email is required
                from_invalid_format:
                  summary: From email invalid format
                  value:
                    status: error
                    message: from email must be a valid email address
                domain_not_whitelisted:
                  summary: Sender domain not whitelisted
                  value:
                    status: error
                    message: >-
                      From email not whitelisted. Please add and verify the
                      domain first.
                addon_not_active:
                  summary: Transactional add-on not active
                  value:
                    status: error
                    message: >-
                      Transactional email add-on is not active. Please activate
                      it first at https://app.sendx.io/setting/addons.
                invalid_recipient:
                  summary: Invalid recipient email format
                  value:
                    status: error
                    message: 'Invalid recipient email address: invalid email format'
        '401':
          description: ❌ Unauthorized - Missing or invalid team API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: The Team ID or API Key specified is not valid
        '422':
          description: ❌ Unprocessable Entity - Invalid request body format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: invalid request body
        '429':
          description: ❌ Too Many Requests - Rate/limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                account_limit:
                  summary: Account email limit exceeded
                  value:
                    status: error
                    message: >-
                      Account email sending limit exceeded. Please upgrade your
                      plan.
                contact_limit:
                  summary: Contact limit exceeded
                  value:
                    status: error
                    message: >-
                      Contact limit exceeded. Current api has {N} contacts, but
                      only {M} emails can be sent.
        '500':
          description: ❌ Internal Server Error - System error occurred
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                account_status:
                  summary: Error getting account email sending status
                  value:
                    status: error
                    message: error getting account email sending status
                queue_failed:
                  summary: Failed to queue email
                  value:
                    status: error
                    message: Failed to queue email for delivery
  /send/template:
    post:
      tags:
        - Email Sending
      summary: Send email using template
      description: >
        Sends emails using a pre-defined template with variable substitution.
        Per-recipient personalization runs in the worker and is not validated in
        the API.


        The API validates the request synchronously and returns **202 Accepted**
        when the email is queued. Actual sending and personalization happen
        asynchronously in a worker. A 202 does not guarantee delivery; it means
        the request was accepted and queued. Per-recipient success/failure is
        not returned in the API response.


        **Optional headers:** `List-Unsubscribe` (passed through for
        list-unsubscribe), `X-SendPost-Mock-Email: true` (mock send, if
        supported).
      operationId: sendEmailWithTemplate
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateEmailMessage'
      responses:
        '202':
          description: ✅ Email queued for delivery
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionalEmailQueueResponse'
              example:
                status: success
                message: Email queued for delivery
        '400':
          description: >-
            ❌ Bad Request - Validation failed (recipients, from, domain, add-on,
            template, invalid to)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                no_recipients:
                  summary: No recipients specified
                  value:
                    status: error
                    message: no recipients specified
                from_required:
                  summary: From email missing
                  value:
                    status: error
                    message: from email is required
                domain_not_whitelisted:
                  summary: Sender domain not whitelisted
                  value:
                    status: error
                    message: >-
                      From email not whitelisted. Please add and verify the
                      domain first.
                template_not_found:
                  summary: Template does not exist
                  value:
                    status: error
                    message: >-
                      Template does not exist: template not found or invalid
                      template id
                recipient_required:
                  summary: Recipient email empty
                  value:
                    status: error
                    message: >-
                      Invalid recipient email address: recipient email is
                      required
                invalid_recipient:
                  summary: Invalid recipient email format
                  value:
                    status: error
                    message: 'Invalid recipient email address: invalid email format'
        '401':
          description: ❌ Unauthorized - Missing or invalid team API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: The Team ID or API Key specified is not valid
        '422':
          description: ❌ Unprocessable Entity - Invalid request body format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: invalid request body
        '429':
          description: ❌ Too Many Requests - Rate/limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: >-
                  Account email sending limit exceeded. Please upgrade your
                  plan.
        '500':
          description: ❌ Internal Server Error - System error occurred
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: Failed to queue email for delivery
  /contact:
    post:
      tags:
        - Contact
      summary: Create a new contact
      description: |
        Creates a new contact in your SendX team with the provided information.

        **🎯 Key Features:**
        - Email validation and duplicate detection
        - Automatic relationship building with lists and tags
        - Smart custom field handling

        **📋 Business Rules:**
        - Email is mandatory and must be unique within the team
        - Last tracked IP is stored for analytics
      operationId: createContact
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEContact'
            examples:
              minimal_contact:
                summary: 🚀 Quick Start - Minimal Contact
                description: Create a contact with just the required email field
                value:
                  email: john.doe@example.com
              basic_contact:
                summary: 📝 Basic Contact with Name
                description: Create a contact with email and name information
                value:
                  email: jane.smith@company.com
                  firstName: Jane
                  lastName: Smith
                  company: Tech Solutions Inc
              complete_contact:
                summary: 🎯 Complete Contact with Relationships
                description: >-
                  Create a fully-featured contact with custom fields, lists, and
                  tags
                value:
                  email: alex.johnson@enterprise.com
                  firstName: Alex
                  lastName: Johnson
                  company: Enterprise Corp
                  customFields:
                    field_MnuqBAG2NPLm7PZMWbjQxt: Engineering
                    field_QqfhckbdcvQinLPlduIbHq: Senior
                    field_rMMSPH9VCIN4NP4CHUyFGH: Premium
                  lists:
                    - list_OcuxJHdiAvujmwQVJfd3ss
                  tags:
                    - tag_UhsDkjL772Qbj5lWtT62VK
                  lastTrackedIp: 192.168.1.100
              marketing_lead:
                summary: 📊 Marketing Lead Example
                description: Typical marketing lead with campaign attribution
                value:
                  email: lead@startup.com
                  firstName: Marketing
                  lastName: Lead
                  company: Startup Inc
                  customFields:
                    field_MnuqBAG2NPLm7PZMWbjQxt: Google Ads
                    field_QqfhckbdcvQinLPlduIbHq: Q1-2024-Growth
                    field_rMMSPH9VCIN4NP4CHUyFGH: $10000
                  lists:
                    - list_vUCjsUmrVXtSppS8rD0Ssq
                  tags:
                    - tag_fL7t9lsnZ9swvx2HrtQ9wM
                    - tag_6GN4DNyrHNt4KktCNG8PDO
                  lastTrackedIp: 203.0.113.42
      responses:
        '201':
          description: ✅ Contact created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRContact'
        '400':
          $ref: '#/components/responses/BadRequest'
          examples:
            missing_email:
              summary: Missing required email field
              value:
                status: error
                message: email is required and cannot be empty
            invalid_email_format:
              summary: Invalid email format
              value:
                status: error
                message: 'invalid email format: must be a valid email address'
            malformed_json:
              summary: Malformed JSON request body
              value:
                status: error
                message: 'invalid request body: unexpected end of JSON input'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
          examples:
            duplicate_email:
              summary: Email already exists in team
              value:
                status: error
                message: email already exists in the team
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Contact
      summary: Get all contacts
      description: >
        Retrieves a paginated list of all contacts in your team with optional
        filtering capabilities.


        **🎯 Key Features:**

        - Pagination support with offset/limit

        - Search contacts by name or email

        - All relationships included (lists, tags, custom fields)

        - Prefixed IDs for easy integration


        **📊 Pagination:**

        - Default limit: 10 contacts per page

        - Maximum limit: 100 contacts per page

        - Use offset for page navigation


        **🔍 Search:**

        - Searches across firstName, lastName, and email fields

        - Case-insensitive partial matching

        - Combine with pagination for large datasets
      operationId: getAllContacts
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: |
            Number of records to skip for pagination.

            **Examples:**
            - `0` - First page (default)
            - `50` - Second page (with limit=50)
            - `100` - Third page (with limit=50)
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
          examples:
            first_page:
              summary: First page
              value: 0
            second_page:
              summary: Second page (50 records per page)
              value: 50
        - name: limit
          in: query
          description: |
            Maximum number of records to return.

            **Constraints:**
            - Minimum: 1
            - Maximum: 100
            - Default: 10
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 30
            default: 10
          examples:
            small_batch:
              summary: Small batch
              value: 10
            standard_batch:
              summary: Standard batch
              value: 20
        - name: search
          in: query
          description: |
            Search term to filter contacts by name or email.

            **Search Behavior:**
            - Searches firstName, lastName, and email fields
            - Case-insensitive partial matching
            - Minimum 2 characters for search

            **Examples:**
            - `john` - Finds "John Doe", "johnson@example.com"
            - `@company.com` - Finds all emails from company.com
            - `smith` - Finds "John Smith", "smith@email.com"
          required: false
          schema:
            type: string
            minLength: 2
            maxLength: 255
          examples:
            name_search:
              summary: Search by name
              value: john
            email_domain_search:
              summary: Search by email domain
              value: '@company.com'
            partial_match:
              summary: Partial name match
              value: smith
      responses:
        '200':
          description: ✅ Contacts retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRContact'
              examples:
                contact_list:
                  summary: List of contacts with relationships
                  value:
                    - id: contact_BnKjkbBBS500CoBCP0oChQ
                      firstName: John
                      lastName: Doe
                      email: john.doe@example.com
                      company: Example Corp
                      customFields:
                        field_MnuqBAG2NPLm7PZMWbjQxt: Sales
                        field_QqfhckbdcvQinLPlduIbHq: Manager
                      lists:
                        - list_OcuxJHdiAvujmwQVJfd3ss
                        - list_0tOFLp5RgV7s3LNiHrjGYs
                      tags:
                        - tag_6GN4DNyrHNt4KktCNG8PDO
                        - tag_UhsDkjL772Qbj5lWtT62VK
                      unsubscribed: false
                      bounced: false
                      spam: false
                      blocked: false
                      dropped: false
                      created: '2024-01-10T14:20:00Z'
                      updated: '2024-01-15T09:15:00Z'
                      trackData: utm_source=website
                      contactSource: 1
                      pageSource: https://example.com/signup
                      lastTrackedIp: 203.0.113.42
                      ltv: 1500
                    - id: contact_AXCZG3Ii9bjBoUUINcSqo8
                      firstName: Jane
                      lastName: Smith
                      email: jane.smith@company.com
                      company: Tech Solutions
                      customFields:
                        field_MnuqBAG2NPLm7PZMWbjQxt: Engineering
                      lists:
                        - list_OcuxJHdiAvujmwQVJfd3ss
                      tags:
                        - tag_fL7t9lsnZ9swvx2HrtQ9wM
                      unsubscribed: false
                      bounced: false
                      spam: false
                      blocked: false
                      dropped: false
                      created: '2024-01-12T16:45:00Z'
                      updated: '2024-01-12T16:45:00Z'
                      trackData: ''
                      contactSource: 2
                      pageSource: ''
                      lastTrackedIp: 198.51.100.25
                      ltv: 0
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /contact/{identifier}:
    get:
      tags:
        - Contact
      summary: Get contact by ID
      description: |
        Retrieves detailed information about a specific contact.

        **🎯 Key Features:**
        - Returns complete contact profile
        - Includes all lists and tags
        - Shows custom field values
        - Provides engagement metrics
      operationId: getContact
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Contact retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRContact'
              examples:
                full_contact_profile:
                  summary: Complete contact profile
                  value:
                    id: contact_BnKjkbBBS500CoBCP0oChQ
                    firstName: Alexander
                    lastName: Johnson
                    email: alex.johnson@enterprise.com
                    company: Enterprise Solutions Inc
                    customFields:
                      field_MnuqBAG2NPLm7PZMWbjQxt: Engineering
                      field_QqfhckbdcvQinLPlduIbHq: Senior Developer
                      field_rMMSPH9VCIN4NP4CHUyFGH: Premium
                      field_ImuqBAG2NPLm7PZMWbjQxt: $75000
                      field_RxfhckbdcvQinLPlduIbHq: '85'
                    lists:
                      - list_vUCjsUmrVXtSppS8rD0Ssq
                      - list_0tOFLp5RgV7s3LNiHrjGYs
                      - list_OcuxJHdiAvujmwQVJfd3ss
                    tags:
                      - tag_UhsDkjL772Qbj5lWtT62VK
                      - tag_LhsDkjL772Qbj5lWtT62VK
                      - tag_fL7t9lsnZ9swvx2HrtQ9wM
                      - tag_mL7t9lsnZ9swvx2HrtQ9wM
                    unsubscribed: false
                    bounced: false
                    spam: false
                    blocked: false
                    dropped: false
                    created: '2024-01-05T08:30:00Z'
                    updated: '2024-01-20T15:45:00Z'
                    trackData: utm_source=google&utm_campaign=enterprise&utm_medium=cpc
                    contactSource: 1
                    pageSource: https://enterprise.com/signup?ref=google-ads
                    lastTrackedIp: 203.0.113.100
                    ltv: 7500
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Contact
      summary: Update contact
      description: |
        Updates an existing contact's information.

        **🎯 Key Features:**
        - Partial updates supported
        - Add/remove lists and tags
        - Update custom fields
        - Change email address
      operationId: updateContact
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEContact'
            examples:
              name_update:
                summary: 📝 Update Name Information
                description: Simple name and company update
                value:
                  firstName: Alexander
                  lastName: Johnson-Smith
                  company: New Enterprise Corp
              email_change:
                summary: ✉️ Change Email Address
                description: Update email address (must be unique)
                value:
                  email: alexander.johnson@newcompany.com
                  company: New Company Inc
              add_custom_fields:
                summary: 📊 Add Custom Field Data
                description: Add or update custom field information
                value:
                  customFields:
                    field_QqfhckbdcvQinLPlduIbHq: '92'
                    field_rMMSPH9VCIN4NP4CHUyFGH: '2024-01-20'
                    field_MnuqBAG2NPLm7PZMWbjQxt: High-value prospect, follow up Q2
              relationship_update:
                summary: 🏷️ Update Lists and Tags
                description: Change list and tag associations
                value:
                  lists:
                    - list_0tOFLp5RgV7s3LNiHrjGYs
                    - list_vUCjsUmrVXtSppS8rD0Ssq
                  tags:
                    - tag_6GN4DNyrHNt4KktCNG8PDO
                    - tag_UhsDkjL772Qbj5lWtT62VK
                    - tag_UhsDkjL772Qbj5lWtT62VK
              complete_update:
                summary: 🎯 Complete Profile Update
                description: Update multiple aspects of the contact
                value:
                  firstName: Alex
                  lastName: Johnson
                  company: Enterprise Solutions LLC
                  customFields:
                    field_MnuqBAG2NPLm7PZMWbjQxt: CTO Office
                    field_rMMSPH9VCIN4NP4CHUyFGH: $100000
                    field_QqfhckbdcvQinLPlduIbHq: 'true'
                  lists:
                    - list_OcuxJHdiAvujmwQVJfd3ss
                    - list_0tOFLp5RgV7s3LNiHrjGYs
                  tags:
                    - tag_fL7t9lsnZ9swvx2HrtQ9wM
                    - tag_UhsDkjL772Qbj5lWtT62VK
                    - tag_high_budget
                  lastTrackedIp: 203.0.113.150
      responses:
        '200':
          description: ✅ Contact updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRContact'
              examples:
                updated_contact:
                  summary: Successfully updated contact
                  value:
                    id: contact_BnKjkbBBS500CoBCP0oChQ
                    firstName: Alex
                    lastName: Johnson
                    email: alex.johnson@enterprise.com
                    company: Enterprise Solutions LLC
                    customFields:
                      field_MnuqBAG2NPLm7PZMWbjQxt: CTO Office
                      field_QqfhckbdcvQinLPlduIbHq: Senior Developer
                      field_rMMSPH9VCIN4NP4CHUyFGH: $100000
                      field_LqfhckbdcvQinLPlduIbHq: 'true'
                    lists:
                      - list_OcuxJHdiAvujmwQVJfd3ss
                      - list_0tOFLp5RgV7s3LNiHrjGYs
                    tags:
                      - tag_fL7t9lsnZ9swvx2HrtQ9wM
                      - tag_UhsDkjL772Qbj5lWtT62VK
                      - tag_LesDkjL772Qbj5lWtT62VK
                    unsubscribed: false
                    bounced: false
                    spam: false
                    blocked: false
                    dropped: false
                    created: '2024-01-05T08:30:00Z'
                    updated: '2024-01-21T10:15:00Z'
                    trackData: utm_source=google&utm_campaign=enterprise
                    contactSource: 1
                    pageSource: https://enterprise.com/signup
                    lastTrackedIp: 203.0.113.150
                    ltv: 7500
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Contact
      summary: Delete contact
      description: |
        Soft deletes a contact from your team.

        **🎯 Key Features:**
        - Soft delete preserves data
        - Removes from all lists
        - Cancels pending campaigns
        - Maintains historical data
      operationId: deleteContact
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Contact deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
              examples:
                deletion_success:
                  summary: Successful contact deletion
                  value:
                    status: success
                    message: >-
                      contact  (jane.smith@company.com) has been deleted
                      successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /contact/unsubscribe/{identifier}:
    post:
      tags:
        - Contact
      summary: Unsubscribe contact
      description: |
        Unsubscribes a contact from all marketing communications.

        **🎯 Key Features:**
        - Marks contact as unsubscribed
        - Removes from all active campaigns
        - Maintains unsubscribe history
        - Complies with anti-spam regulations
      operationId: unsubscribeContact
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Contact unsubscribed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /contact/identify:
    post:
      tags:
        - Tracking
      summary: Identify contact
      description: |
        Endpoint for identifying contacts. Creates or updates a contact.


        **🎯 Key Features:**
        - Creates contact if doesn't exist
        - Updates if email already exists
        - Supports custom fields, tags and lists
      operationId: identifyContact
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IdentifyRequest'
            examples:
              minimal_identify:
                summary: 🚀 Quick Start - Minimal Identify
                description: Identify a contact with just the required email field
                value:
                  email: john.doe@example.com
              complete_identify:
                summary: 📝 Complete Identify with Name
                description: Identify a contact with email and name information
                value:
                  email: jane.smith@company.com
                  firstName: Jane
                  lastName: Smith
                  company: Tech Solutions Inc
                  customFields:
                    Role: Engineering
                    Position: Senior
                    Plan: Premium
                  tags:
                    - new_user
                  lists:
                    - Users
      responses:
        '200':
          description: ✅ Contact identified successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentifyResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /contact/identify/bulk:
    post:
      tags:
        - Tracking
      summary: Identify Bulk Contacts
      description: >
        Endpoint for identifying bulk contacts. Creates or updates multiple
        contacts in a single request.


        **🎯 Key Features:**

        - Creates contact if doesn't exist

        - Updates if email already exists

        - Supports custom fields and tags

        - Supports batch operations (max 25 contacts per request)
      operationId: identifyBulkContact
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/IdentifyRequest'
              minItems: 1
              maxItems: 25
            examples:
              minimal_bulk_identify:
                summary: 🚀 Quick Start - Minimal Bulk Identify
                description: Identify multiple contacts with just the required email field
                value:
                  - email: john.doe@example.com
                  - email: alice@example.com
              complete_bulk_identify:
                summary: 📝 Complete Bulk Identify with Name and Tags
                description: Identify multiple contacts with full details
                value:
                  - email: jane.smith@company.com
                    firstName: Jane
                    lastName: Smith
                    company: Tech Solutions Inc
                    customFields:
                      Role: Engineering
                      Position: Senior
                      Plan: Premium
                    tags:
                      - new_user
                  - email: mark.johnson@example.com
                    firstName: Mark
                    lastName: Johnson
                    customFields:
                      Region: US-East
                    tags:
                      - beta_tester
      responses:
        '200':
          description: ✅ All contacts identified successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: All contacts processed successfully
        '400':
          description: >-
            ❌ Invalid request (e.g., more than 10 contacts, invalid email, wrong
            format)
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /contact/track:
    post:
      tags:
        - Tracking
      summary: Track contact
      description: |
        Legacy endpoint for tracking contact behavior through tags.


        **🎯 Key Features:**
        - Add or remove tags
        - Trigger automations
        - Track user behavior
      operationId: trackContact
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrackRequest'
            examples:
              track_request:
                value:
                  email: test@example.com
                  addTags:
                    - new
                    - cool
                  removeTags:
                    - old
                    - bad
      responses:
        '200':
          description: ✅ Contact tracked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrackResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /campaign:
    post:
      tags:
        - Campaign
      summary: Create campaign
      description: |
        Creates a new email campaign.
      operationId: createCampaign
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestECampaign'
            examples:
              immediate_campaign:
                summary: 🚀 Send Immediately Campaign
                value:
                  name: Flash Sale Announcement
                  subject: ⚡ 24-Hour Flash Sale - {{contact.firstName}}, Save 50%!
                  sender: sender_4vK3WFhMgvOwUNyaL4QxCD
                  previewText: Limited time offer - Today only!
                  htmlCode: >-
                    <html><body><h1>Flash Sale!</h1><p>Hi
                    {{contact.firstName}},</p><p>Don't miss our 24-hour flash
                    sale!</p><a href='{{sale.url}}'>Shop Now</a></body></html>
                  plainText: |-
                    Flash Sale!

                    Hi {{contact.firstName}},

                    Don't miss our 24-hour flash sale!

                    Shop now: {{sale.url}}
                  scheduleType: 1
                  includedLists:
                    - list_0tOFLp5RgV7s3LNiHrjGYs
                    - list_vUCjsUmrVXtSppS8rD0Ssq
                  excludedTags:
                    - tag_unengaged
              scheduled_newsletter:
                summary: 📅 Scheduled Newsletter
                value:
                  name: Monthly Newsletter - March 2024
                  subject: '{{company.name}} March Newsletter'
                  sender: sender_lN1aAQOmYEUp4LtH5szP3l
                  previewText: Product updates, tips, and special offers inside
                  htmlCode: >-
                    <html><head><style>.newsletter{max-width:600px;margin:0
                    auto;}</style></head><body><div class='newsletter'><h1>March
                    Newsletter</h1>{{newsletter.content}}</div></body></html>
                  plainText: |-
                    March Newsletter

                    {{newsletter.content.text}}
                  scheduleType: 0
                  scheduleCondition: '2024-03-01'
                  timeCondition: 9:00 AM
                  timezone: America/New_York
                  includedLists:
                    - list_0tOFLp5RgV7s3LNiHrjGYs
                  excludedLists:
                    - list_A1b2C3d4E5f6G7h8I9j0Kl
                  sendInContactsTimezone: false
              targeted_segment_campaign:
                summary: 🎯 Targeted Segment Campaign
                value:
                  name: VIP Customer Exclusive Offer
                  subject: Exclusive VIP Offer - {{contact.firstName}}, You're Invited!
                  sender: sender_jAf07DHbIQfHfpefQqoKCP
                  previewText: Special pricing available only for our VIP members
                  htmlCode: >-
                    <html><body><div class='vip-offer'><h1>VIP
                    Exclusive</h1><p>As a valued VIP member, enjoy 30%
                    off...</p></div></body></html>
                  plainText: |-
                    VIP Exclusive

                    As a valued VIP member, enjoy 30% off...
                  scheduleType: 1
                  includedTags:
                    - tag_6GN4DNyrHNt4KktCNG8PDO
                    - tag_fL7t9lsnZ9swvx2HrtQ9wM
                  includedSegments:
                    - segment_6GN4DNyrHNt4KktCNG8PDO
                  excludedTags:
                    - segment_6GN4DNyrHNt4KktCNG8PDO
                  smartSend: true
                  sendInContactsTimezone: true
                  preferredTimeCondition: 10:00 AM
                  preferredTimezone: America/Los_Angeles
      responses:
        '201':
          description: ✅ Campaign created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRCampaign'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Campaign
      summary: Get all campaigns
      description: |
        Retrieves a paginated list of all campaigns.
      operationId: getAllCampaigns
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of campaigns to skip
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: limit
          in: query
          description: Maximum number of campaigns to return
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
        - name: campaignType
          in: query
          description: Filter by campaign type
          schema:
            type: string
            enum:
              - all
              - draft
              - scheduled
              - sent
            default: all
      responses:
        '200':
          description: ✅ Campaigns retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRCampaign'
              examples:
                campaign_list:
                  summary: List of campaigns with various statuses
                  value:
                    - id: campaign_IMBoxK2iB5sUdgiNOjqAMA
                      name: March Newsletter
                      status: 3
                      subject: March Updates from {{company.name}}
                      preheader: Spring is here - Don't miss our latest updates!
                      sender: sender_xY4nBk89vL2PqR0mT7hEwJ
                      scheduleType: 1
                      scheduleCondition: '2025-03-15'
                      scheduleTime: '2025-03-15T14:00:00Z'
                      scheduleTimezone: America/New_York
                      includedLists:
                        - list_A1b2C3d4E5f6G7h8I9j0Kl
                        - list_Mn7Op8Qr9St0Uv1Wx2Yz3A
                      excludedTags:
                        - tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe
                      smartSend: true
                      sendInContactsTimezone: false
                      preferredTimeCondition: 09:00 AM
                      preferredTimezone: America/New_York
                      campaignScreenshotUrl: https://cdn.sendx.io/campaigns/march_newsletter.png
                    - id: campaign_Jexkb4tu7FoPJ4dvJDQYS5
                      name: Welcome Series - Email 1
                      status: 1
                      subject: Welcome to {{company.name}}!
                      sender: sender_Po9Lq8RmTz7WvXy0Ab1CdE
                      scheduleType: 0
                      includedTags:
                        - tag_Df9Gh0JkLm2Np3QrSt5UvW
                      isArchived: false
                      smartSend: false
                    - id: campaign_6h8DnYrHt4KktCnG8PDO5Z
                      name: Flash Sale - 24 Hours Only
                      status: 2
                      subject: ⏰ 24 Hour Flash Sale – Up to 70% Off!
                      sender: sender_Jk8Lm0NpQr2StUvWx3Yz4A
                      scheduleType: 1
                      scheduleCondition: '2025-08-05'
                      scheduleTime: '2025-08-05T09:00:00Z'
                      scheduleTimezone: Asia/Kolkata
                      includedLists:
                        - list_Ty6UvWx7Yz8A9Bc0De1FgH
                      includedTags:
                        - tag_Op9QrSt0Uv1Wx2Yz3AbCdE
                      excludedLists:
                        - list_Xy3Zb4C5De6Fg7Hi8Jk9Lm
                      sendInContactsTimezone: true
                      preferredTimeCondition: 10:00 AM
                      preferredTimezone: Asia/Kolkata
                      strategy: Batch Sending
                      smartSend: true
                    - id: campaign_Mo5Np6Qr7St8Uv9WxYz0Ab
                      name: Customer Re-Engagement
                      status: 4
                      subject: We miss you – Here’s 20% off to come back
                      sender: sender_Np3QrSt5UvWx7Yz8Ab9CdE
                      scheduleType: 2
                      includedSegments:
                        - segment_Gh8Ij9Kl0Mn1Op2Qr3StUv
                      excludedSegments:
                        - segment_Xy0Za1Bc2De3Fg4Hi5JkLm
                      strategy: Time-Optimized
                      smartSend: false
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /campaign/{identifier}:
    get:
      tags:
        - Campaign
      summary: Get campaign by ID
      description: |
        Retrieves detailed information about a specific campaign.
      operationId: getCampaign
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            Campaign identifier
            - `campaign_IMBoxK2iB5sUdgiNOjqAMA`
          schema:
            type: string
            pattern: ^(campaign_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Campaign retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRCampaign'
              examples:
                scheduled_campaign:
                  value:
                    id: campaign_LUE9BTxmksSmqHWbh96zsn
                    name: Spring Sale Campaign
                    trackReply: true
                    status: 1
                    scheduleType: 0
                    scheduleCondition: '2024-03-20'
                    timeCondition: 10:00 PM
                    timezone: America/New_York
                    preferredTimeCondition: 10:00 PM
                    preferredTimezone: America/New_York
                    strategy: Batch Sending
                    sendInContactsTimezone: true
                    smartSend: true
                    isArchived: false
                    sender: sender_lN1aAQOmYEUp4LtH5szP3l
                    campaignScreenshotUrl: https://cdn.sendx.io/campaigns/spring_sale_preview.png
                    includedLists:
                      - list_0tOFLp5RgV7s3LNiHrjGYs
                      - list_A1b2C3d4E5f6G7h8I9j0Kl
                    includedTags:
                      - tag_6GN4DNyrHNt4KktCNG8PDO
                    excludedTags:
                      - tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe
                    subject: 🌸 Spring Sale - Save up to 40%!
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Campaign
      summary: Delete campaign
      description: |
        Deletes a campaign.
      operationId: deleteCampaign
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Campaign identifier to delete
          schema:
            type: string
            pattern: ^(campaign_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Campaign deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /list:
    post:
      tags:
        - List
      summary: Create list
      description: |
        Creates a new contact list.
      operationId: createList
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEList'
            examples:
              basic_list:
                summary: 📝 Basic List with Name
                value:
                  name: Premium Members
      responses:
        '201':
          description: ✅ List created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - List
      summary: Get all lists
      description: |
        Retrieves all contact lists in your team.
      operationId: getAllLists
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: limit
          in: query
          description: 'Maximum number of lists to return (max: 500)'
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: search
          in: query
          description: Search lists by name
          required: false
          schema:
            type: string
            minLength: 2
            maxLength: 100
      responses:
        '200':
          description: ✅ Lists retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRList'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /list/{identifier}:
    get:
      tags:
        - List
      summary: Get list by ID
      description: |
        Retrieves detailed information about a specific list.
      operationId: getList
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            List identifier
            - `list_OcuxJHdiAvujmwQVJfd3ss`
          schema:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ List retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRList'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - List
      summary: Update list
      description: |
        Updates an existing list's settings.
      operationId: updateList
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: List identifier to update
          schema:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEList'
            examples:
              update_name:
                summary: 📝 Update list name
                value:
                  name: 2024 Newsletter Subscribers
      responses:
        '200':
          description: ✅ List updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRList'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - List
      summary: Delete list
      description: |
        Deletes a list.
      operationId: deleteList
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: List identifier to delete
          schema:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ List deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /tag:
    post:
      tags:
        - Tag
      summary: Create tag
      description: |
        Creates a new tag for contact categorization.
      operationId: createTag
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestETag'
            examples:
              basic_tag:
                summary: Basic tag creation
                value:
                  name: VIP Customer
              lifecycle_tag:
                summary: Customer lifecycle tag
                value:
                  name: 'Lifecycle: Active Customer'
      responses:
        '201':
          description: ✅ Tag created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Tag
      summary: Get all tags
      description: |
        Retrieves all tags in your team.
      operationId: getAllTags
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of tags to skip
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: limit
          in: query
          description: Maximum number of tags to return
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: ✅ Tags retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRTag'
              examples:
                tags_list:
                  value:
                    - id: tag_abc123def456
                      name: VIP Customer
                      created: '2024-01-20T10:30:00Z'
                      updated: '2024-01-20T10:30:00Z'
                    - id: tag_def456ghi789
                      name: Newsletter Subscriber
                      created: '2024-01-15T14:20:00Z'
                      updated: '2024-01-18T09:15:00Z'
                    - id: tag_ghi789jkl012
                      name: Webinar Attendee
                      created: '2024-01-10T08:45:00Z'
                      updated: '2024-01-10T08:45:00Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /tag/{identifier}:
    get:
      tags:
        - Tag
      summary: Get tag by ID
      description: |
        Retrieves detailed information about a specific tag.
      operationId: getTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Tag identifier to retrieve
          schema:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Tag retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Tag
      summary: Update tag
      description: |
        Updates an existing tag's name.
      operationId: updateTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Tag identifier to update
          schema:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestETag'
      responses:
        '200':
          description: ✅ Tag updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Tag
      summary: Delete tag
      description: |
        Deletes a tag from the system.
      operationId: deleteTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Tag identifier to update
          schema:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Tag deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /sender:
    post:
      tags:
        - Sender
      summary: Create sender
      description: |
        Adds a new sender email address.
      operationId: createSender
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestESender'
      responses:
        '201':
          description: ✅ Sender created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRSender'
              examples:
                personal_sender:
                  summary: Personal sender
                  value:
                    name: John Smith
                    email: john@example.com
                company_sender:
                  summary: Company sender
                  value:
                    name: Example Company
                    email: newsletter@example.com
                support_sender:
                  summary: Support team sender
                  value:
                    name: Support Team
                    email: support@example.com
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Sender
      summary: Get all senders
      description: |
        Retrieves all verified sender addresses.
      operationId: getAllSenders
      security:
        - TeamApiKey: []
      responses:
        '200':
          description: ✅ Senders retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRSender'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /template/email:
    post:
      tags:
        - Template
      summary: Create email template
      description: |
        Creates a new reusable email template.
      operationId: createEmailTemplate
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestETemplate'
            examples:
              drag_drop_template:
                summary: 📱 Drag & Drop Newsletter Template
                value:
                  name: Weekly Newsletter Template
                  htmlCode: >-
                    <div class="newsletter"><h1>{{company.name}} Weekly
                    Update</h1><div
                    class="content">{{email.content}}</div></div>
                  templateCode: >-
                    {"type":"doc","content":[{"type":"paragraph","attrs":{"textAlign":null,"showIfKey":null},"content":[{"type":"text","text":"This
                    is a new template"}]}]}
                  editorType: 1
              plain_text_template:
                summary: 📝 Simple Text Template
                value:
                  name: Welcome Email - Plain Text
                  htmlCode: >-
                    <p>Welcome to
                    {{company.name}}!</p><p>{{welcome.message}}</p>
                  editorType: 0
              advanced_html_template:
                summary: 🎨 Advanced HTML Template
                value:
                  name: E-commerce Product Showcase
                  htmlCode: >-
                    <html><head><style>.product{border:1px solid
                    #ddd;padding:20px;}</style></head><body><div
                    class="product"><h2>{{product.name}}</h2><img
                    src="{{product.image}}"
                    alt="Product"><p>{{product.description}}</p><a
                    href="{{product.url}}" class="btn">Shop
                    Now</a></div></body></html>
                  templateCode: >-
                    {"type":"doc","content":[{"type":"paragraph","attrs":{"textAlign":null,"showIfKey":null},"content":[{"type":"text","text":"This
                    is a new template"}]}]}
                  editorType: 2
      responses:
        '201':
          description: ✅ Template created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTemplate'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Template
      summary: Get all templates
      description: |
        Retrieves all email templates.
      operationId: getAllEmailTemplates
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: |
            Number of records to skip for pagination.

            **Examples:**
            - `0` - First page (default)
            - `25` - Second page (with limit=25)
            - `50` - Third page (with limit=25)
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: limit
          in: query
          description: |
            Maximum number of templates to return per page.

            **Guidelines:**
            - Default: 10 templates
            - Maximum: 100 templates
            - Recommended: 25-100 for optimal performance
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: search
          in: query
          description: |
            Search templates by name (case-insensitive partial matching).

            **Examples:**
            - `newsletter` - Finds "Weekly Newsletter", "Monthly Newsletter"
            - `welcome` - Finds "Welcome Email", "New User Welcome"
            - `product` - Finds "Product Launch", "Product Update"
          required: false
          schema:
            type: string
            minLength: 2
            maxLength: 100
      responses:
        '200':
          description: ✅ Templates retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRTemplate'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /template/email/{identifier}:
    get:
      tags:
        - Template
      summary: Get template by ID
      description: |
        Retrieves a specific email template.
      operationId: getEmailTemplate
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique template identifier. 
            - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID
          schema:
            type: string
            pattern: ^(template_)?[a-zA-Z0-9]{22}$
            example: template_f3lJvTEhSjKGVb5Lwc5SWS
      responses:
        '200':
          description: ✅ Template retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTemplate'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Template
      summary: Update template
      description: |
        Updates an existing email template.
      operationId: updateEmailTemplate
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique template identifier to update.

            - `template_f3lJvTEhSjKGVb5Lwc5SWS`
          schema:
            type: string
            pattern: ^(template_)?[a-zA-Z0-9]{22}$
            example: template_f3lJvTEhSjKGVb5Lwc5SWS
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestETemplate'
      responses:
        '200':
          description: ✅ Template updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRTemplate'
              examples:
                update_newsletter:
                  summary: 📰 Update newsletter template design
                  value:
                    name: Weekly Newsletter Template v2
                    htmlCode: >-
                      <html><head><style>.newsletter{max-width:650px;margin:0
                      auto;font-family:'Helvetica
                      Neue',Arial,sans-serif}.header{background:linear-gradient(135deg,#667eea
                      0%,#764ba2
                      100%);color:white;padding:30px;text-align:center}</style></head><body><div
                      class="newsletter"><div
                      class="header"><h1>{{company.name}}</h1><p>Your Weekly
                      Digest</p></div><div
                      class="content">{{email.content}}</div></div></body></html>
                    templateCode: '{}'
                    editorType: 1
                upgrade_to_advanced:
                  summary: 🚀 Upgrade to advanced HTML editor
                  value:
                    name: Advanced Product Showcase
                    htmlCode: >-
                      <html><head><meta name="viewport"
                      content="width=device-width,initial-scale=1"><style>@media
                      (max-width:600px){.product-grid{grid-template-columns:1fr!important}}.product-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:20px;padding:20px}</style></head><body><div
                      class="product-grid">{{#products}}<div
                      class="product"><img src="{{image}}"
                      alt="{{name}}"><h3>{{name}}</h3><p
                      class="price">{{price}}</p><a href="{{url}}"
                      class="btn">Buy
                      Now</a></div>{{/products}}</div></body></html>
                    templateCode: ''
                    editorType: 2
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Template
      summary: Delete template
      description: |
        Deletes an email template.
      operationId: deleteEmailTemplate
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique template identifier to update.

            - `template_f3lJvTEhSjKGVb5Lwc5SWS`
          schema:
            type: string
            pattern: ^(template_)?[a-zA-Z0-9]{22}$
            example: template_f3lJvTEhSjKGVb5Lwc5SWS
      responses:
        '200':
          description: ✅ Template deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /customfield:
    post:
      tags:
        - Custom Field
      summary: Create custom field
      description: |
        Creates a new custom field for storing contact data.
      operationId: createCustomField
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestECustomField'
      responses:
        '201':
          description: ✅ Custom field created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRCustomField'
              examples:
                text_field:
                  summary: Text custom field
                  value:
                    name: Account Type
                    type: 0
                    description: Customer account classification
                number_field:
                  summary: Number custom field
                  value:
                    name: Loyalty Points
                    type: 1
                    description: Current loyalty program points balance
                date_field:
                  summary: Date custom field
                  value:
                    name: Subscription Expiry
                    type: 2
                    description: Date when subscription expires
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Custom Field
      summary: Get all custom fields
      description: |
        Retrieves all custom fields defined for your team.
      operationId: getAllCustomFields
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of fields to skip for pagination
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: limit
          in: query
          description: Maximum number of fields to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: search
          in: query
          description: |
            Search custom fields by name (case-insensitive partial matching).

            **Examples:**
            - `points` - Finds "Loyalty points", "Reward points"
          required: false
          schema:
            type: string
            minLength: 2
            maxLength: 100
      responses:
        '200':
          description: ✅ Custom fields retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRCustomField'
              examples:
                fields_list:
                  value:
                    - id: custom_field_abc123def456ghi789
                      name: Account Type
                      type: 0
                      description: Customer account classification
                    - id: custom_field_abc123def456ghi783
                      name: Loyalty Points
                      type: 1
                      description: Current loyalty program points
                    - id: custom_field_abc123def456ghi703
                      name: Last Purchase Date
                      type: 2
                      description: Date of most recent purchase
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /customfield/{identifier}:
    get:
      tags:
        - Custom Field
      summary: Get custom field by ID
      description: |
        Retrieves details about a specific custom field.
      operationId: getCustomField
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Custom field identifier to update
          schema:
            type: string
            pattern: ^(custom_field_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Custom field retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRCustomField'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Custom Field
      summary: Update custom field
      description: |
        Updates a custom field definition.
      operationId: updateCustomField
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Custom field identifier to update
          schema:
            type: string
            pattern: ^(custom_field_)?[a-zA-Z0-9]{22}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestECustomField'
            examples:
              update_name:
                summary: Update field name
                value:
                  name: Customer Tier
                  description: Customer segmentation tier (Bronze/Silver/Gold)
      responses:
        '200':
          description: ✅ Custom field updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRCustomField'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Custom Field
      summary: Delete custom field
      description: |
        Deletes a custom field (data is preserved).

        **🎯 Key Features:**
        - Remove unused fields
        - Data remains on contacts
        - Clean up field list
      operationId: deleteCustomField
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Custom field identifier to update
          schema:
            type: string
            pattern: ^(custom_field_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Custom field deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /webhook:
    post:
      tags:
        - Webhook
      summary: Create webhook
      description: |
        Creates a new webhook for event notifications.
      operationId: createWebhook
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEWebhook'
            examples:
              all_events:
                summary: Subscribe to all events
                value:
                  enabled: true
                  url: https://api.example.com/webhooks/sendx
                  unsubscribed: true
                  dropped: true
                  bounced: true
                  markedSpam: true
                  clicked: true
                  opened: true
                  contactCreated: true
              engagement_only:
                summary: Track engagement events only
                value:
                  enabled: true
                  url: https://api.example.com/webhooks/engagement
                  unsubscribed: false
                  dropped: false
                  bounced: false
                  markedSpam: false
                  clicked: true
                  opened: true
                  contactCreated: false
              lifecycle_events:
                summary: Contact lifecycle events
                value:
                  enabled: true
                  url: https://api.example.com/webhooks/lifecycle
                  unsubscribed: true
                  dropped: true
                  bounced: true
                  markedSpam: true
                  clicked: false
                  opened: false
                  contactCreated: true
      responses:
        '201':
          description: ✅ Webhook created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRWebhook'
              examples:
                webhook_created:
                  value:
                    id: webhook_9l154iiXlZoPo7vngmamee
                    enabled: true
                    url: https://api.example.com/webhooks/sendx
                    unsubscribed: true
                    dropped: true
                    bounced: true
                    markedSpam: true
                    clicked: true
                    opened: true
                    contactCreated: true
                    created: 1705750200
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Webhook
      summary: Get all webhooks
      description: |
        Retrieves all configured webhooks.
      operationId: getAllWebhooks
      security:
        - TeamApiKey: []
      responses:
        '200':
          description: ✅ Webhooks retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRWebhook'
              examples:
                webhooks_list:
                  value:
                    - id: webhook_iqj3OR6VbjaO2fohm72MYy
                      enabled: true
                      url: https://api.example.com/webhooks/all
                      unsubscribed: true
                      dropped: true
                      bounced: true
                      markedSpam: true
                      clicked: true
                      opened: true
                      contactCreated: true
                      created: 1705750200
                    - id: webhook_kQJ17si7GhhaKDsPxyXLxY
                      enabled: false
                      url: https://api.example.com/webhooks/engagement
                      unsubscribed: false
                      dropped: false
                      bounced: false
                      markedSpam: false
                      clicked: true
                      opened: true
                      contactCreated: false
                      created: 1705663800
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /webhook/{identifier}:
    get:
      tags:
        - Webhook
      summary: Get webhook by ID
      description: |
        Retrieves details about a specific webhook.
      operationId: getWebhook
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Webhook identifier to retrieve
          schema:
            type: string
            pattern: ^(webhook_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Webhook retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRWebhook'
              examples:
                webhook_details:
                  value:
                    id: webhook_9l154iiXlZoPo7vngmamee
                    enabled: true
                    url: https://api.example.com/webhooks/sendx
                    unsubscribed: true
                    dropped: true
                    bounced: true
                    markedSpam: true
                    clicked: true
                    opened: true
                    contactCreated: true
                    created: 1705750200
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Webhook
      summary: Update webhook
      description: |
        Updates webhook configuration.
      operationId: updateWebhook
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Webhook identifier to update
          schema:
            type: string
            pattern: ^(webhook_)?[a-zA-Z0-9]{22}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEWebhook'
      responses:
        '200':
          description: ✅ Webhook updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRWebhook'
              examples:
                change_url:
                  summary: Update webhook URL
                  value:
                    enabled: true
                    url: https://new-api.example.com/webhooks/sendx
                    unsubscribed: true
                    dropped: true
                    bounced: true
                    markedSpam: true
                    clicked: true
                    opened: true
                    contactCreated: true
                disable_webhook:
                  summary: Temporarily disable webhook
                  value:
                    enabled: false
                    url: https://api.example.com/webhooks/sendx
                    unsubscribed: true
                    dropped: true
                    bounced: true
                    markedSpam: true
                    clicked: true
                    opened: true
                    contactCreated: true
                add_events:
                  summary: Add click tracking
                  value:
                    enabled: true
                    url: https://api.example.com/webhooks/sendx
                    unsubscribed: true
                    dropped: true
                    bounced: true
                    markedSpam: true
                    clicked: true
                    opened: true
                    contactCreated: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Webhook
      summary: Delete webhook
      description: |
        Deletes a webhook configuration.

        **🎯 Key Features:**
        - Remove webhooks
        - Stop event delivery
        - Clean up endpoints
      operationId: deleteWebhook
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Webhook identifier to update
          schema:
            type: string
            pattern: ^(webhook_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Webhook deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /events/revenue:
    post:
      tags:
        - Events
      summary: Push revenue event
      description: |
        Records revenue events for analytics and attribution.
      operationId: trackRevenueEvent
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RevenueEventRequest'
      responses:
        '200':
          description: ✅ Revenue event tracked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /events/custom:
    post:
      tags:
        - Events
      summary: Push custom event
      description: |
        Records custom events for advanced tracking.
      operationId: trackCustomEvent
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomEventRequest'
            examples:
              videoWatched:
                summary: Video watched event
                value:
                  identifier: user@example.com
                  name: video_watched
                  data:
                    video_id: '12345'
                    duration: '120'
                    completed: 'true'
                  time: 1669990400
              productPurchased:
                summary: Product purchased event
                value:
                  identifier: buyer@example.com
                  name: product_purchased
                  data:
                    product_id: sku_001
                    amount: '49.99'
                    currency: USD
                  time: 1669990400
              signupCompleted:
                summary: Signup completed event
                value:
                  identifier: newuser@example.com
                  name: signup_completed
                  data:
                    referral_code: FRIEND50
                    plan: premium
      responses:
        '200':
          description: ✅ Custom event tracked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /events/revenue/postback:
    get:
      summary: Revenue Event Postback URL
      description: Trigger a revenue postback for a specific team and event.
      tags:
        - Event
      parameters:
        - name: team_id
          in: query
          description: The unique identifier for the team.
          required: true
          schema:
            type: string
        - name: id
          in: query
          description: The unique sendx identifier for the contact/customer.
          required: true
          schema:
            type: string
        - name: amount
          in: query
          description: The revenue amount to be posted back.
          required: true
          schema:
            type: number
            format: float
        - name: campaign_id
          in: query
          description: The unique identifier for the campaign.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Revenue postback processed successfully.
                  status:
                    type: string
                    example: success
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Invalid parameters provided.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: An unexpected error occurred.
  /events/custom/postback:
    get:
      summary: Custom Event Postback URL
      description: Register a custom event for a specific team and event.
      tags:
        - Event
      parameters:
        - name: team_id
          in: query
          description: The unique identifier for the team.
          required: true
          schema:
            type: string
        - name: id
          in: query
          description: The unique sendx identifier for the contact/customer.
          required: true
          schema:
            type: string
        - name: event
          in: query
          description: The custom event name.
          required: true
          schema:
            type: string
        - name: any-key
          in: query
          description: >
            Arbitrary custom data as key-value pairs. Add custom parameters
            directly to the query string. 

            For example, `amount=24.43` or `currency=USD`.
          required: true
          schema:
            type: string
            example: '24.43'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Revenue postback processed successfully.
                  status:
                    type: string
                    example: success
  /report/campaign/{identifier}:
    get:
      tags:
        - Report
      summary: Get campaign report
      description: |
        Retrieves a detailed performance report for a specific campaign.
      operationId: getCampaignReport
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Report retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestReportData'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /post:
    post:
      tags:
        - Post
      summary: Create blog post
      description: |
        Creates a new blog post.
      operationId: createPost
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPost'
            examples:
              MinimalDraft:
                summary: Minimal Draft Post
                value:
                  name: launch_draft_2025
                  postTitle: Upcoming Product Launch
              FullPublishedPost:
                summary: Fully Published Post
                value:
                  name: summer_collection_2025
                  postTitle: Introducing Our New Summer Collection
                  postDescription: >-
                    Take a look at our vibrant summer wear designed for comfort
                    and style.
                  postCategory: post_category_YzS1wOU20yw87UUHKxMzwn
                  member: member_JkL012MnO345PqR678
                  postThumbnail: https://cdn.example.com/images/summer-thumb.jpg
                  postHtml: >-
                    <h1>Welcome to Summer 2025!</h1><p>Explore our latest
                    collection...</p>
                  postTemplate: default-blog
                  isPublished: true
                  includedTags:
                    - tag_XYZ12abc345
                    - tag_123LMN456
                  editorType: 1
                  postSlug: introducing-summer-collection
                  status: 1
                  pageTitle: Introducing Our Summer Collection | Example Blog
                  pageDescription: >-
                    Explore our fresh 2025 summer styles with vibrant colors and
                    cool fabrics.
                  pageKeywords: summer, collection, fashion, 2025
                  socialTitle: Our 2025 Summer Line is Here!
                  socialDescription: Take a sneak peek at our sun-ready styles!
                  socialImageUrl: https://cdn.example.com/images/summer-social.jpg
              MarkdownEditorPost:
                summary: Post by Specific Author Using Markdown
                value:
                  name: technical_article_01
                  postTitle: Understanding REST APIs in 10 Minutes
                  member: member_AaBbCcDdEe123
                  postHtml: <p>This post covers REST fundamentals...</p>
                  editorType: 2
                  isPublished: true
      responses:
        '201':
          description: ✅ Post created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPost'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
    get:
      tags:
        - Post
      summary: Get all posts
      description: |
        Retrieves all blog posts with pagination.

        **🎯 Key Features:**
        - Filter by status
        - Search functionality
        - Sort options
        - Include metadata
      operationId: getAllPosts
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of posts to skip
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: limit
          in: query
          description: Maximum number of posts to return
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: ✅ Posts retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRPost'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /post/{identifier}:
    get:
      tags:
        - Post
      summary: Get post by ID
      description: |
        Retrieves a specific blog post.

        **🎯 Key Features:**
        - Full post content
        - SEO metadata
        - Related posts
        - Engagement metrics
      operationId: getPost
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Post retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPost'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Post
      summary: Update post
      description: |
        Updates an existing blog post.

        **🎯 Key Features:**
        - Edit content
        - Update metadata
        - Change status
        - Modify tags/categories
      operationId: updatePost
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPost'
      responses:
        '200':
          description: ✅ Post updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPost'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Post
      summary: Delete post
      description: |
        Soft deletes a blog post.

        **🎯 Key Features:**
        - Soft delete
        - Preserve data
        - Remove from listings
      operationId: deletePost
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Post deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /post/category:
    post:
      tags:
        - Post Category
      summary: Create post category
      description: |
        Creates a new category for organizing blog posts.
      operationId: createPostCategory
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPostCategory'
            examples:
              product_updates:
                value:
                  name: Product Updates
              feature_requests:
                value:
                  name: Feature Requests
      responses:
        '201':
          description: ✅ Category created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostCategory'
              examples:
                product_updates:
                  value:
                    id: post_category_YzS1wOU20yw87UUHKxMzwn
                    name: Product Updates
                    created: '2022-05-23T11:00:00.000Z'
                    updated: '2022-05-23T11:00:00.000Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
    get:
      tags:
        - Post Category
      summary: Get all post categories
      description: |
        Retrieves all blog post categories.
      operationId: getAllPostCategories
      security:
        - TeamApiKey: []
      responses:
        '200':
          description: ✅ Categories retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRPostCategory'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /post/category/{identifier}:
    get:
      tags:
        - Post Category
      summary: Get post category by ID
      description: |
        Retrieves a specific post category.
      operationId: getPostCategory
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post category identifier to retrieve.
            - `post_category_YzS1wOU20yw87UUHKxMzwn`
          schema:
            type: string
            pattern: ^(post_category_)?[a-zA-Z0-9]{22}$
            example: post_category_YzS1wOU20yw87UUHKxMzwn
      responses:
        '200':
          description: ✅ Category retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostCategory'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Post Category
      summary: Update post category
      description: |
        Updates a post category.
      operationId: updatePostCategory
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post category identifier to retrieve.
            - `post_category_YzS1wOU20yw87UUHKxMzwn`
          schema:
            type: string
            pattern: ^(post_category_)?[a-zA-Z0-9]{22}$
            example: post_category_YzS1wOU20yw87UUHKxMzwn
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPostCategory'
      responses:
        '200':
          description: ✅ Category updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostCategory'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Post Category
      summary: Delete post category
      description: |
        Soft deletes a post category.
      operationId: deletePostCategory
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post category identifier to retrieve.
            - `post_category_YzS1wOU20yw87UUHKxMzwn`
          schema:
            type: string
            pattern: ^(post_category_)?[a-zA-Z0-9]{22}$
            example: post_category_YzS1wOU20yw87UUHKxMzwn
      responses:
        '200':
          description: ✅ Category deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /post/tag:
    post:
      tags:
        - Post Tag
      summary: Create post tag
      description: |
        Creates a new tag for blog posts.
      operationId: createPostTag
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPostTag'
      responses:
        '201':
          description: ✅ Tag created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostTag'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Post Tag
      summary: Get all post tags
      description: |
        Retrieves all blog post tags.
      operationId: getAllPostTags
      security:
        - TeamApiKey: []
      responses:
        '200':
          description: ✅ Tags retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRPostTag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /post/tag/{identifier}:
    get:
      tags:
        - Post Tag
      summary: Get post tag by ID
      description: |
        Retrieves a specific post tag.
      operationId: getPostTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post tag identifier to retrieve.
            - `post_tag_leBDiFdrUnRmRz4nfopSrv`
          schema:
            type: string
            pattern: ^(post_tag_)?[a-zA-Z0-9]{22}$
            example: post_tag_leBDiFdrUnRmRz4nfopSrv
      responses:
        '200':
          description: ✅ Tag retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostTag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Post Tag
      summary: Update post tag
      description: |
        Updates a post tag.
      operationId: updatePostTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post tag identifier to retrieve.
            - `post_tag_leBDiFdrUnRmRz4nfopSrv`
          schema:
            type: string
            pattern: ^(post_tag_)?[a-zA-Z0-9]{22}$
            example: post_tag_leBDiFdrUnRmRz4nfopSrv
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEPostTag'
      responses:
        '200':
          description: ✅ Tag updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRPostTag'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
    delete:
      tags:
        - Post Tag
      summary: Delete post tag
      description: |
        Soft deletes a post tag.
      operationId: deletePostTag
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: |
            The unique post tag identifier to retrieve.
            - `post_tag_leBDiFdrUnRmRz4nfopSrv`
          schema:
            type: string
            pattern: ^(post_tag_)?[a-zA-Z0-9]{22}$
            example: post_tag_leBDiFdrUnRmRz4nfopSrv
      responses:
        '200':
          description: ✅ Tag deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /team/member:
    get:
      tags:
        - Team Member
      summary: Get all team members
      description: Retrieves all team members.
      operationId: getAllTeamMembers
      security:
        - TeamApiKey: []
      responses:
        '200':
          description: ✅ Tags retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRMember'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /team/member/{identifier}:
    get:
      tags:
        - Team Member
      summary: Get a team member by ID
      description: Retrieves a single team member by their unique identifier.
      operationId: getTeamMember
      security:
        - TeamApiKey: []
      parameters:
        - $ref: '#/components/parameters/identifier'
      responses:
        '200':
          description: ✅ Team member retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRMember'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /domain:
    post:
      tags:
        - Domain
      summary: Create domain
      description: >
        Creates a new domain for email sending. After creation, you'll need to
        configure DNS records (DKIM, SPF, DMARC) to verify the domain.
      operationId: createDomain
      security:
        - TeamApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestEDomain'
            examples:
              basic_domain:
                summary: Basic domain creation
                value:
                  name: Example.com
      responses:
        '201':
          description: ✅ Domain created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRDomain'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Domain
      summary: Get all domains
      description: >
        Retrieves all domains in your team with their verification status and
        DNS configuration details.
      operationId: getAllDomains
      security:
        - TeamApiKey: []
      parameters:
        - name: offset
          in: query
          description: Number of domains to skip
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: limit
          in: query
          description: Maximum number of domains to return
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: ✅ Domains retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestRDomain'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /domain/{identifier}:
    get:
      tags:
        - Domain
      summary: Get domain by ID
      description: >
        Retrieves detailed information about a specific domain including
        verification status and DNS configuration.
      operationId: getDomain
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Domain identifier to retrieve
          schema:
            type: string
            pattern: ^(domain_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Domain retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestRDomain'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      tags:
        - Domain
      summary: Delete domain
      description: |
        Deletes a domain from the system.
      operationId: deleteDomain
      security:
        - TeamApiKey: []
      parameters:
        - name: identifier
          in: path
          required: true
          description: Domain identifier to delete
          schema:
            type: string
            pattern: ^(domain_)?[a-zA-Z0-9]{22}$
      responses:
        '200':
          description: ✅ Domain deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
webhooks:
  SendXWebhooks:
    post:
      tags:
        - Webhook
      summary: SendX Webhook Object
      description: >-
        SendX webhooks allow you to receive real-time notifications about
        various events in your team. Every event generated as a SendX webhook
        will include a <code>type</code> field in the event object that
        identifies the type of event that occurred.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookObject'
      responses:
        '200':
          description: >-
            Return a 200 status to indicate that the data was received
            successfully
components:
  securitySchemes:
    TeamApiKey:
      type: apiKey
      in: header
      name: X-Team-ApiKey
      description: >
        Team API key for authentication. Find your API key in SendX Settings →
        Team API Key.


        **Example:**

        ```

        X-Team-ApiKey: your_team_api_key_here

        ```
  parameters:
    identifier:
      name: identifier
      in: path
      required: true
      description: |
        Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)

        **Format:** `<prefix>_<22-character-id>`
      schema:
        type: string
        pattern: ^[a-z_]+_[a-zA-Z0-9]{22}$
        example: contact_BnKjkbBBS500CoBCP0oChQ
  responses:
    BadRequest:
      description: ❌ Bad Request - Invalid input data
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_id:
              summary: Invalid ID format
              value:
                status: error
                message: Invalid identifier format
            missing_field:
              summary: Missing required field
              value:
                status: error
                message: Email is required
    Unauthorized:
      description: ❌ Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 401
            message: The Team ID or API Key specified is not valid
    Forbidden:
      description: ❌ Forbidden - Resource name already exists
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Resource with this name already exists
    NotFound:
      description: ❌ Not Found - Resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Resource not found
    Conflict:
      description: ❌ Conflict - Resource already exists
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Email already exists
    UnprocessableEntity:
      description: ❌ Unprocessable Entity - Invalid request format
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Request body is not in proper format
    TooManyRequests:
      description: ❌ Too Many Requests - Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Email sending limit exceeded. Please upgrade your plan.
    InternalServerError:
      description: ❌ Internal Server Error - System error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Internal server error occurred
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
          example: error
        message:
          type: string
          description: Human-readable error message
          example: Invalid request format
      required:
        - status
        - message
    MessageResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
          example: Operation completed successfully
    DeleteResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          example: success
        message:
          type: string
          example: Resource deleted successfully
      required:
        - status
        - message
    TransactionalEmailQueueResponse:
      type: object
      description: >-
        Success response when transactional email is queued for delivery (202
        Accepted)
      properties:
        status:
          type: string
          enum:
            - success
          example: success
        message:
          type: string
          example: Email queued for delivery
      required:
        - status
        - message
    XEmailMessage:
      type: object
      required:
        - from
        - to
        - subject
        - htmlBody
      properties:
        from:
          $ref: '#/components/schemas/XFrom'
        to:
          type: array
          items:
            $ref: '#/components/schemas/XTo'
          minItems: 1
        replyTo:
          $ref: '#/components/schemas/XReplyTo'
        subject:
          type: string
          example: Your Subject Here
        htmlBody:
          type: string
          example: <h1>Your HTML Content</h1>
        textBody:
          type: string
          example: Your Text Content
        headers:
          type: object
          description: >-
            Custom headers can be added to the email. These will be passed on
            when receving webhooks events for this email.
          additionalProperties:
            type: string
          example:
            X-Custom-Header: Value
    TemplateEmailMessage:
      type: object
      required:
        - from
        - to
        - subject
        - template
      properties:
        from:
          $ref: '#/components/schemas/XFrom'
        to:
          type: array
          items:
            $ref: '#/components/schemas/XTo'
          minItems: 1
        replyTo:
          $ref: '#/components/schemas/XReplyTo'
        subject:
          type: string
          example: Your Subject Here
          description: Override template subject
        template:
          type: string
          description: Template identifier
          example: template_f3lJvTEhSjKGVb5Lwc5SWS
    XFrom:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          example: from@example.com
        name:
          type: string
          example: From Name
    XTo:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          example: to@example.com
        name:
          type: string
          example: To Name
        customFields:
          type: object
          additionalProperties:
            type: string
    XReplyTo:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          example: reply@example.com
        name:
          type: string
          example: Reply Name
    XEmailResponse:
      type: object
      properties:
        to:
          type: string
          format: email
          description: Recipient email address
        submittedAt:
          type: integer
          format: int64
          description: Unix timestamp of submission
        errorCode:
          type: integer
          description: Error code (0 = success)
        message:
          type: string
          description: Status message
    RestEContact:
      type: object
      required:
        - email
      properties:
        firstName:
          type: string
          maxLength: 255
          description: First name of the contact
          example: John
        lastName:
          type: string
          maxLength: 255
          description: Last name of the contact
          example: Doe
        email:
          type: string
          format: email
          maxLength: 255
          description: >
            Email address of the contact (required and must be unique within
            team).


            **Validation:**

            - Must be a valid email format

            - Must be unique within the team

            - Cannot be empty or null
          example: john.doe@example.com
        company:
          type: string
          maxLength: 255
          description: Company name of the contact
          example: Example Corp
        customFields:
          type: object
          additionalProperties:
            type: string
          description: >
            Custom fields as key-value pairs. Keys should use `custom_field_`
            prefix.


            **Processing:**

            - Keys are case-sensitive

            - Values are stored as strings


            **Examples:**

            - `"field_MnuqBAG2NPLm7PZMWbjQxt": "Engineering"` → stored as
            `department: Engineering`
          example:
            field_MnuqBAG2NPLm7PZMWbjQxt: Engineering
            field_QqfhckbdcvQinLPlduIbHq: Senior
        lists:
          type: array
          items:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
          description: |
            Array of list identifiers to associate with the contact. 
            Identifiers should use `list_` prefix.

            **Processing:**
            - Invalid list IDs will send our 400 error
            - Duplicates will be removed

            **Examples:**
            - `"list_OcuxJHdiAvujmwQVJfd3ss"` → valid prefixed format
          example:
            - list_OcuxJHdiAvujmwQVJfd3ss
        tags:
          type: array
          items:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
          description: |
            Array of tag identifiers to associate with the contact.
            Identifiers should use `tag_` prefix.

            **Processing:**
            - Invalid tag IDs will be ignored
            - Duplicates will be removed

            **Examples:**
            - `"tag_UhsDkjL772Qbj5lWtT62VK"` → valid prefixed format
          example:
            - tag_UhsDkjL772Qbj5lWtT62VK
        lastTrackedIp:
          type: string
          format: ipv4
          description: |
            Last tracked IP address of the contact for analytics purposes.

            **Usage:**
            - Used for geographic analytics
            - Helps with spam detection
            - Optional field
          example: 192.168.1.100
    RestRContact:
      type: object
      properties:
        id:
          type: string
          pattern: ^contact_[a-zA-Z0-9]{22}$
          description: |
            Unique contact identifier with contact_ prefix.

            **Format:** `contact_` + 22 alphanumeric characters

            **Usage:**
            - Use this ID for all subsequent API calls
            - Unique across the entire SendX platform
            - Never changes once created
          example: contact_BnKjkbBBS500CoBCP0oChQ
        firstName:
          type: string
          nullable: true
          description: First name of the contact
          example: John
        lastName:
          type: string
          nullable: true
          description: Last name of the contact
          example: Doe
        email:
          type: string
          format: email
          description: Email address of the contact (unique within team)
          example: john.doe@example.com
        company:
          type: string
          nullable: true
          description: Company name of the contact
          example: Example Corp
        customFields:
          type: object
          additionalProperties:
            type: string
          description: |
            Custom fields with custom_field_ prefixed keys.

            **Format:** All keys have `custom_field_` prefix in responses

            **Example Structure:**
            ```json
            {
              "field_MnuqBAG2NPLm7PZMWbjQxt": "Engineering",
              "field_QqfhckbdcvQinLPlduIbHq": "Senior",
              "field_MnuqBAG2NPLm7PZMWbjQxt": "$75000"
            }
            ```
          example:
            field_MnuqBAG2NPLm7PZMWbjQxt: Engineering
            field_QqfhckbdcvQinLPlduIbHq: Senior
        lists:
          type: array
          items:
            type: string
            pattern: ^list_[a-zA-Z0-9]{22}$
          description: |
            Associated lists with list_ prefixed identifiers.

            **Format:** All IDs have `list_` prefix in responses
          example:
            - list_OcuxJHdiAvujmwQVJfd3ss
            - list_xyz789ghi012
        tags:
          type: array
          items:
            type: string
            pattern: ^tag_[a-zA-Z0-9]{22}$
          description: |
            Associated tags with tag_ prefixed identifiers.

            **Format:** All IDs have `tag_` prefix in responses
          example:
            - tag_UhsDkjL772Qbj5lWtT62VK
            - tag_UhsDkjL772Qbj5lWtT62VK
        unsubscribed:
          type: boolean
          description: Whether the contact has unsubscribed from emails
          example: false
        bounced:
          type: boolean
          description: Whether emails to this contact have bounced
          example: false
        spam:
          type: boolean
          description: Whether the contact has marked emails as spam
          example: false
        blocked:
          type: boolean
          description: Whether the contact is blocked from receiving emails
          example: false
        dropped:
          type: boolean
          description: Whether emails to this contact have been dropped
          example: false
        created:
          type: string
          format: date-time
          description: Contact creation timestamp (ISO 8601 format)
          example: '2024-01-10T14:20:00Z'
        updated:
          type: string
          format: date-time
          description: Contact last update timestamp (ISO 8601 format)
          example: '2024-01-15T09:15:00Z'
        trackData:
          type: string
          description: |
            Email tracking data and UTM parameters.

            **Contains:**
            - UTM parameters from campaigns
            - Attribution data
            - Custom tracking parameters
          example: utm_source=website&utm_campaign=signup&utm_medium=banner
        contactSource:
          type: integer
          description: |
            Source type of the contact creation.

            **Values:**
            - `1` - API/Manual
            - `2` - Import
            - `3` - Form
            - `4` - Integration
          example: 1
        pageSource:
          type: string
          nullable: true
          description: URL of the page where contact was created
          example: https://example.com/signup?ref=google-ads
        lastTrackedIp:
          type: string
          format: ipv4
          nullable: true
          description: Last tracked IP address of the contact
          example: 203.0.113.42
        LTV:
          type: integer
          description: |
            Lifetime Value of the contact in cents.

            **Example:** 7500 = $75.00
          example: 7500
    RestECampaign:
      type: object
      required:
        - name
        - subject
        - htmlCode
        - sender
      properties:
        name:
          type: string
          maxLength: 255
          description: Campaign name for internal organization
          example: Spring Sale Campaign
        subject:
          type: string
          maxLength: 255
          description: |
            Email subject line with personalization support.

            **Features:**
            - Supports template variables ({{contact.firstName}})
            - Emoji support for better engagement
            - A/B testing variations supported
          example: 🌸 Spring Sale - {{contact.firstName}}, Save 30%!
        sender:
          type: string
          pattern: ^(sender_)?[a-zA-Z0-9]{22}$
          description: |
            Sender identifier.

            **Note:** Sender must be verified before use
          example: sender_4vK3WFhMgvOwUNyaL4QxCD
        htmlCode:
          type: string
          description: HTML content of the email campaign
          example: >-
            <html><body><h1>Spring Sale!</h1><p>Save 30% on all
            items</p></body></html>
        previewText:
          type: string
          maxLength: 255
          description: Preview text shown in email clients
          example: Limited time offer - 30% off everything!
        plainText:
          type: string
          description: Plain text version for better deliverability
          example: |-
            Spring Sale!

            Save 30% on all items...
        scheduleType:
          type: integer
          description: |
            Campaign scheduling type.

            **Values:**
            - `0` - Schedule for specific date/time
            - `1` - Send immediately
          example: 0
        scheduleCondition:
          type: string
          description: datetime for scheduled campaigns (required if scheduleType=0)
          example: '2024-03-20'
        timeCondition:
          type: string
          description: Time condition for scheduled campaigns in HH:MM PM/AM format
          example: 9:00 AM
        timezone:
          type: string
          description: Timezone for scheduled campaigns (IANA format)
          example: America/New_York
        preferredTimezone:
          type: string
          description: >-
            Preferred timezone for smart send optimization (required for
            smartSend and sendInContactsTimezone)
          example: America/Los_Angeles
        preferredTimeCondition:
          type: string
          description: >-
            Preferred time optimization setting (required for smartSend and
            sendInContactsTimezone)
          example: 10:00 AM
        sendInContactsTimezone:
          type: boolean
          description: Send at specified time in each contact's timezone
          example: true
        smartSend:
          type: boolean
          description: Enable AI-powered send time optimization
          example: true
        includedSegments:
          type: array
          items:
            type: string
            pattern: ^segment_[a-zA-Z0-9]{22}$
          description: Segment IDs to include
          example:
            - segment_v3nooFn4M423mFomfml4P
        includedLists:
          type: array
          items:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
          description: List IDs to include
          example:
            - list_vUCjsUmrVXtSppS8rD0Ssq
        includedTags:
          type: array
          items:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
          description: Tag IDs to include
          example:
            - tag_6GN4DNyrHNt4KktCNG8PDO
        excludedSegments:
          type: array
          items:
            type: string
            pattern: ^segment_[a-zA-Z0-9]{22}$
          description: Segment IDs to exclude
          example:
            - segment_v3nooFn4M423mFomfml4P
        excludedLists:
          type: array
          items:
            type: string
            pattern: ^(list_)?[a-zA-Z0-9]{22}$
          description: List IDs to exclude
          example:
            - list_0tOFLp5RgV7s3LNiHrjGYs
        excludedTags:
          type: array
          items:
            type: string
            pattern: ^(tag_)?[a-zA-Z0-9]{22}$
          description: Tag IDs to exclude (prefix automatically stripped)
          example:
            - tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe
    RestRCampaign:
      type: object
      required:
        - name
        - subject
        - sender
        - includedLists
        - excludedLists
        - scheduleType
        - scheduleCondition
        - timezone
      properties:
        id:
          type: string
          description: Unique ID for the campaign
          example: campaign_6h8DnYrHt4KktCnG8PDO5Z
        name:
          type: string
          description: Internal campaign name
          example: Summer Sale 2024
        subject:
          type: string
          description: Email subject line
          example: 🌞 Summer Sale - 50% Off Everything!
        preheader:
          type: string
          description: Email preview text
          example: Limited time offer - Shop now!
        sender:
          type: string
          description: Sender id
          example: sender_4vK3WFhMgvOwUNyaL4QxCD
        htmlContent:
          type: string
          description: HTML email content
        textContent:
          type: string
          description: Plain text email content
        status:
          type: integer
          description: |
            Campaign status.

            **Values:**
            - `0` - Draft
            - `1` - Scheduled
            - `2` - Sending
            - `3` - Sent
            - `4` - Quarantined
            - `5` - Evaluating
            - `6` - Evaluation Failed
            - `7` - Warming Up
        isArchived:
          type: boolean
          description: Whether the campaign is archived
          example: false
        campaignScreenshotUrl:
          type: string
          description: URL to the campaign screenshot
          example: https://cdn.sendx.io/campaigns/screenshot_abc123.png
        scheduleType:
          type: integer
          default: 0
          description: |
            Campaign scheduling type.

            **Values:**
            - `0` - Schedule later
            - `1` - Send Now
        scheduleCondition:
          type: string
          description: datetime for scheduled campaigns (required if scheduleType=1)
          example: '2024-12-30'
        timeCondition:
          type: string
          description: Time-related condition for the campaign
          example: 9:00 AM
        timezone:
          type: string
          description: Campaign timezone
          example: America/New_York
        smartSend:
          type: boolean
          description: Timezone for the scheduled send
          example: America/New_York
        sendInContactsTimezone:
          type: boolean
          description: Send at specified time in each contact's timezone
          example: true
        preferredTimeCondition:
          type: string
          description: >-
            Preferred time condition, in case of smartSend and
            sendInContactTimeZone
          example: 10:00 AM
        preferredTimezone:
          type: string
          description: Preferred timezone for smart send optimization
          example: America/Los_Angeles
        strategy:
          type: string
          description: Campaign delivery strategy
          example: Batch Sending
        includedSegments:
          type: array
          items:
            type: string
            pattern: ^segment_[a-zA-Z0-9]{22}$
          description: Included segment IDs
          example:
            - segment_engaged_30_days
        includedLists:
          type: array
          items:
            type: string
            pattern: ^list_[a-zA-Z0-9]{22}$
          description: Included list IDs with prefix
          example:
            - list_vUCjsUmrVXtSppS8rD0Ssq
            - list_0tOFLp5RgV7s3LNiHrjGYs
        includedTags:
          type: array
          items:
            type: string
            pattern: ^tag_[a-zA-Z0-9]{22}$
          description: Included tag IDs with prefix
          example:
            - tag_6GN4DNyrHNt4KktCNG8PDO
            - tag_UhsDkjL772Qbj5lWtT62VK
        excludedSegments:
          type: array
          items:
            type: string
            pattern: ^segment_[a-zA-Z0-9]{22}$
          description: Excluded segment IDs
          example: []
        excludedLists:
          type: array
          items:
            type: string
            pattern: ^list_[a-zA-Z0-9]{22}$
          description: Excluded list IDs with prefix
          example:
            - list_Mn7Op8Qr9St0Uv1Wx2Yz3A
        excludedTags:
          type: array
          items:
            type: string
            pattern: ^tag_[a-zA-Z0-9]{22}$
          description: Excluded tag IDs with prefix
          example:
            - tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
    RestEList:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: List name
          example: Newsletter Subscribers
    RestRList:
      type: object
      properties:
        id:
          type: string
          example: list_OcuxJHdiAvujmwQVJfd3ss
        name:
          type: string
          example: Newsletter Subscribers
        type:
          type: integer
          description: |
            List type.

            **Values:**
            - `0` - Regular list (single opt-in)
            - `1` - Double opt-in list (requires email confirmation)
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
    RestETag:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Tag name (must be unique within team)
          example: VIP Customer
    RestRTag:
      type: object
      properties:
        id:
          type: string
          pattern: ^tag_[a-zA-Z0-9]{22}$
          description: Unique tag identifier with tag_ prefix
          example: tag_abc123def456ghi789
        name:
          type: string
          description: Tag name
          example: VIP Customer
        created:
          type: string
          format: date-time
          description: Tag creation timestamp
          example: '2024-01-20T10:30:00Z'
        updated:
          type: string
          format: date-time
          description: Tag last update timestamp
          example: '2024-01-20T10:30:00Z'
    RestESender:
      type: object
      required:
        - name
        - email
      properties:
        name:
          type: string
          description: Sender display name
          example: John Smith
        email:
          type: string
          format: email
          description: Sender email address (must be verified)
          example: john@example.com
    RestRSender:
      type: object
      properties:
        id:
          type: string
          pattern: ^sender_[a-zA-Z0-9]{22}$
          description: Unique sender identifier with sender_ prefix
          example: sender_4vK3WFhMgvOwUNyaL4QxCD
        name:
          type: string
          description: Sender display name
          example: John Smith
        email:
          type: string
          format: email
          description: Sender email address
          example: john@example.com
        isWhitelisted:
          type: boolean
          description: Sender whitelist status
          example: true
    RestEDomain:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Domain name (e.g., example.com)
          example: Example.com
    RestRDomain:
      type: object
      properties:
        id:
          type: string
          pattern: ^domain_[a-zA-Z0-9]{22}$
          description: Unique domain identifier with domain_ prefix
          example: domain_504
        name:
          type: string
          description: Domain name
          example: sx13.email
        verified:
          type: boolean
          description: Overall domain verification status
          example: false
        returnPathVerified:
          type: boolean
          description: Return path (bounce) verification status
          example: false
        dkimVerified:
          type: boolean
          description: DKIM verification status
          example: false
        trackVerified:
          type: boolean
          description: Tracking domain verification status
          example: false
        dmarcVerified:
          type: boolean
          description: DMARC verification status
          example: false
        gptVerified:
          type: boolean
          description: GPT (Google Postmaster Tools) verification status
          example: false
        dkim:
          type: object
          description: DKIM DNS record configuration
          properties:
            host:
              type: string
              example: sp-dkim._domainkey.sx13.email
            type:
              type: string
              example: TXT
            textValue:
              type: string
              example: >-
                v=DKIM1;k=rsa;s=email;h=sha256;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC94euUPiD9e9jO4rgnjWYSa6YOcYz24SkrNPJ6u9AaeDG8Zvwu3om4sxkGrQ3vO1hoX9RQnccBCM9y+9Z6fCFmwI6eGjtskxLPLThMSsjDACL3iI1UYTZyuSHEk67QoLsgSmcTTtVjBGdtPi2w6SsXOauXav07wB7VPuDL/Q1zOQIDAQAB
        returnPath:
          type: object
          description: Return path (bounce) DNS record configuration
          properties:
            host:
              type: string
              example: sp-bounce.sx13.email
            type:
              type: string
              example: CNAME
            textValue:
              type: string
              example: sp.sendpost.info
        track:
          type: object
          description: Tracking domain DNS record configuration
          properties:
            host:
              type: string
              example: sp-track.sx13.email
            type:
              type: string
              example: CNAME
            textValue:
              type: string
              example: track.sptrackh.com
        dmarc:
          type: object
          description: DMARC DNS record configuration
          properties:
            host:
              type: string
              example: _dmarc.sx13.email
            type:
              type: string
              example: TXT
            textValue:
              type: string
              example: v=DMARC1; p=none;
        gpt:
          type: object
          description: GPT (Google Postmaster Tools) DNS record configuration
          properties:
            host:
              type: string
              example: sx13.email
            type:
              type: string
              example: TXT
            textValue:
              type: string
              example: ''
        dkimConfig:
          type: string
          description: DKIM configuration in JSON format
          example: >-
            {"Domain":"sx13.email","PubKey":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC94euUPiD9e9jO4rgnjWYSa6YOcYz24SkrNPJ6u9AaeDG8Zvwu3om4sxkGrQ3vO1hoX9RQnccBCM9y+9Z6fCFmwI6eGjtskxLPLThMSsjDACL3iI1UYTZyuSHEk67QoLsgSmcTTtVjBGdtPi2w6SsXOauXav07wB7VPuDL/Q1zOQIDAQAB","PrivKey":"-----BEGIN
            RSA PRIVATE
            KEY-----\nMIICXAIBAAKBgQC94euUPiD9e9jO4rgnjWYSa6YOcYz24SkrNPJ6u9AaeDG8Zvwu\n3om4sxkGrQ3vO1hoX9RQnccBCM9y+9Z6fCFmwI6eGjtskxLPLThMSsjDACL3iI1U\nYTZyuSHEk67QoLsgSmcTTtVjBGdtPi2w6SsXOauXav07wB7VPuDL/Q1zOQIDAQAB\nAoGAH2MFvtZaO6xKFUCSsi8ETU0wALkyVOi5FmRFJJaA+q8dgYgAbXrphvdLzrey\nUvYbUf1tKfo6l+gt6lLIjCySlJFUkFbHeQlch+ZfhvyCP+2zo6JrFSRosZGYsZhb\ncBnnfzi+r6FDCiobLn8Y78eEli0RX7lvUC4VSJ6J2vTiybUCQQDJQqWqvPe8vdr+\neHioA7YeWiCInhHD6ylKMqCwFTkdjbhUoK5rZmnQJ2xmAljEz7pdpgxeg8oNFLfO\namXLKGSfAkEA8YcOmAC3sdTXYMptwnQ4Y4IOOaY/0HXM6YEnmRbN526CBRciUdj/\ndoc24g+Ibx5IVPRkQBWuWiB6OIP5wY6BJwJAA93G5vfIXpTbHyZbUwb3ObALjfRT\nbQsYePduBNPzi/DMCLwpfaCzCa+oMnF7GRTQhLoK5MntWMD8IvgCSpvVCwJAHhZY\n9w5/06NUATa2XZbkv2CgLQZMxMcn856nNCbnF4FoqQGswM1rZXSKnbaZpF39XLfl\nFSaeRZPuJcQrBLWf2QJBAKAakfXcnF3N5v37r3TMl31vrMyBBSihKTxs3y5b+JqQ\nINkXkhATSdxwZzwLHbkGmzNVgrCTX5+ZrpxS9jTAUBE=\n-----END
            RSA PRIVATE KEY-----\n","Selector":"sp-dkim","Headers":""}
        dmarcFailureReason:
          type: string
          description: Reason for DMARC verification failure (if any)
          example: ''
        created:
          type: integer
          format: int64
          description: Domain creation timestamp (nanoseconds since epoch)
          example: 1764924919882212400
        updated:
          type: integer
          format: int64
          description: Domain last update timestamp (nanoseconds since epoch)
          example: 0
    RestETemplate:
      type: object
      required:
        - name
        - subject
      properties:
        name:
          type: string
          description: Template name
          example: Welcome Email Template
        htmlCode:
          type: string
          description: HTML email content
        templateCode:
          type: string
          description: Template code for the selected template type
        editorType:
          type: integer
          description: |
            Editor type used to create the template.

            **Values:**
            - `0` - PlainText
            - `1` - DragDrop
            - `2` - SendxEditor
    RestRTemplate:
      type: object
      properties:
        id:
          type: string
          pattern: ^template_[a-zA-Z0-9]{22}$
          description: Unique template identifier with template_ prefix
          example: template_abc123def456ghi789
        name:
          type: string
          description: Name of the template
          example: Welcome Email Template
        subject:
          type: string
          nullable: true
          description: Email subject line (if applicable)
          example: Welcome to our platform!
        htmlCode:
          type: string
          description: HTML content of the template
          example: <html><body><h1>Welcome!</h1></body></html>
        templateCode:
          type: string
          nullable: true
          description: Template code for visual editors (JSON structure)
          example: '{"blocks":[{"type":"text","content":"Welcome!"}]}'
        type:
          type: integer
          description: |
            Template type.

            **Values:**
            - `0` - Email template
            - `1` - Other types
          example: 0
        thumbnail:
          type: string
          nullable: true
          description: URL to template thumbnail image
          example: https://cdn.sendx.io/templates/thumb_abc123.png
        editorType:
          type: integer
          description: |
            Editor type used to create the template.

            **Values:**
            - `0` - PlainText
            - `1` - DragDrop
            - `2` - SendxEditor
          example: 1
        created:
          type: string
          format: date-time
          description: Template creation timestamp
          example: '2024-01-10T14:20:00Z'
        updated:
          type: string
          format: date-time
          description: Template last update timestamp
          example: '2024-01-15T09:15:00Z'
    RestECustomField:
      type: object
      required:
        - name
        - type
        - description
      properties:
        name:
          type: string
          description: Custom field name (must be unique within team)
          example: Account Type
        type:
          type: integer
          description: |
            Field data type.

            **Values:**
            - `0` - Text (max 255 characters)
            - `1` - Number (integer or decimal)
            - `2` - Date (YYYY-MM-DD format)
            - `3` - Boolean (true/false)
            - `4` - Phone number (international format)
        description:
          type: string
          description: Field description for documentation
          example: Customer account classification
    RestRCustomField:
      type: object
      properties:
        id:
          type: string
          pattern: ^custom_field_[a-zA-Z0-9]{22}$
          description: Unique field identifier with custom_field_ prefix
          example: custom_field_abc123def456ghi789
        name:
          type: string
          description: Custom field name
          example: Account Type
        type:
          type: integer
          description: |
            Field data type.

            **Values:**
            - `0` - Text (max 255 characters)
            - `1` - Number (integer or decimal)
            - `2` - Date (YYYY-MM-DD format)
            - `3` - Boolean (true/false)
            - `4` - Phone number (international format)
        description:
          type: string
          description: Field description for documentation
          example: Customer account classification
    RestEWebhook:
      type: object
      required:
        - url
        - enabled
      properties:
        url:
          type: string
          format: uri
          description: Webhook endpoint URL
          example: https://api.example.com/webhooks/sendx
        enabled:
          type: boolean
          default: true
          description: Whether webhook is enabled
        unsubscribed:
          type: boolean
          default: false
          description: Trigger webhook when a contact unsubscribes
        dropped:
          type: boolean
          default: false
          description: Trigger webhook when an email is dropped
        bounced:
          type: boolean
          default: false
          description: Trigger webhook when an email bounces
        markedSpam:
          type: boolean
          default: false
          description: Trigger webhook when an email is marked as spam
        clicked:
          type: boolean
          default: false
          description: Trigger webhook when a link in the email is clicked
        opened:
          type: boolean
          default: false
          description: Trigger webhook when an email is opened
        contactCreated:
          type: boolean
          default: false
          description: Trigger webhook when a new contact is created
    RestRWebhook:
      type: object
      properties:
        id:
          type: string
          example: webhook_9l154iiXlZoPo7vngmamee
        url:
          type: string
          format: uri
          description: Webhook endpoint URL
          example: https://api.example.com/webhooks/sendx
        enabled:
          type: boolean
          default: true
          description: Whether webhook is enabled
        unsubscribed:
          type: boolean
          default: false
          description: Trigger webhook when a contact unsubscribes
        dropped:
          type: boolean
          default: false
          description: Trigger webhook when an email is dropped
        bounced:
          type: boolean
          default: false
          description: Trigger webhook when an email bounces
        markedSpam:
          type: boolean
          default: false
          description: Trigger webhook when an email is marked as spam
        clicked:
          type: boolean
          default: false
          description: Trigger webhook when a link in the email is clicked
        opened:
          type: boolean
          default: false
          description: Trigger webhook when an email is opened
        contactCreated:
          type: boolean
          default: false
          description: Trigger webhook when a new contact is created
    RevenueEventRequest:
      type: object
      required:
        - email
        - amount
      properties:
        identifier:
          type: string
          format: email
          description: Contact email address
          example: customer@example.com
        amount:
          type: number
          format: float
          description: Revenue amount
          example: 99.99
        source:
          type: string
          description: Source of the revenue event
          example: website
        time:
          type: integer
          format: int64
          description: >-
            Unix timestamp (in seconds since January 1, 1970) representing when
            the event occurred.
          example: 1669990400
    CustomEventRequest:
      type: object
      required:
        - identifier
        - name
      properties:
        identifier:
          type: string
          description: >
            This is the contact identifier. Contact id and email can be used
            interchangeably.
          example: user@example.com
        name:
          type: string
          description: Event name
          example: video_watched
        data:
          type: object
          description: Event data
          additionalProperties:
            type: string
          example:
            video_id: '12345'
            duration: '120'
            completed: 'true'
        time:
          type: integer
          format: int64
          description: >-
            Unix timestamp (in seconds since January 1, 1970) representing when
            the event occurred.
          example: 1669990400
    EventResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
          example: Event tracked successfully
    PostbackResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Event tracked via postback
    RestReportData:
      type: object
      properties:
        campaignId:
          type: string
          description: Unique identifier of the campaign
          example: campaign_6h8DnYrHt4KktCnG8PDO5Z
        linkStats:
          type: array
          items:
            $ref: '#/components/schemas/LinkStat'
        clickedUniqueContactCount:
          type: integer
          description: Total number of unique contacts who clicked on the link
          example: 10
        openedUniqueContactCount:
          type: integer
          description: Total number of unique contacts who opened the link
          example: 14
        sentContactCount:
          type: integer
          description: Total number of contacts who sent the link
          example: 20
        unsubscribeContactCount:
          type: integer
          description: Total number of contacts who unsubscribed from the link
          example: 5
        bounceContactCount:
          type: integer
          description: Total number of contacts who bounced the link
          example: 3
        spamContactCount:
          type: integer
          description: Total number of contacts who marked the link as spam
          example: 2
        clickedContactCount:
          type: integer
          description: Total number of contacts who clicked on the link
          example: 10
        openedContactCount:
          type: integer
          description: Total number of contacts who opened the link
          example: 14
    LinkStat:
      type: object
      properties:
        url:
          type: string
          description: The link clicked
          example: https://sendx.io
        count:
          type: integer
          description: Total number of times the link was clicked
          example: 10
      description: Link statistics
      example:
        url: https://sendx.io
        count: 10
    RestEPost:
      type: object
      required:
        - name
        - postTitle
      properties:
        name:
          type: string
          description: Internal post name
          example: Summer Product Launch
        postTitle:
          type: string
          description: Public post title
          example: Introducing Our New Summer Collection
        postDescription:
          type: string
          description: Post excerpt/description
        postCategory:
          type: string
          description: Category ID (with or without prefix)
          example: post_category_YzS1wOU20yw87UUHKxMzwn
        member:
          type: string
          description: Author member ID
          example: member_JkL012MnO345PqR678
        postThumbnail:
          type: string
          format: uri
          description: Thumbnail image URL
        postHtml:
          type: string
          description: Post HTML content
        postTemplate:
          type: string
          description: Post template
        isPublished:
          type: boolean
          default: false
          description: Publication status
        includedTags:
          type: array
          description: Post tag IDs
          items:
            type: string
        editorType:
          type: integer
          description: Editor type used
          default: 1
        postSlug:
          type: string
          description: URL slug
          example: introducing-summer-collection
        status:
          type: integer
          description: Post status
          default: 1
        pageTitle:
          type: string
          description: SEO page title
        pageDescription:
          type: string
          description: SEO meta description
        pageKeywords:
          type: string
          description: SEO keywords
        socialTitle:
          type: string
          description: Social media title
        socialDescription:
          type: string
          description: Social media description
        socialImageUrl:
          type: string
          format: uri
          description: Social media image URL
    RestRPost:
      type: object
      properties:
        id:
          type: string
          example: post_XyZ123aBc456DeF789GhI
        name:
          type: string
          example: Summer Product Launch
        postTitle:
          type: string
          example: Introducing Our New Summer Collection
        postDescription:
          type: string
        postCategory:
          type: string
          example: post_category_YzS1wOU20yw87UUHKxMzwn
        member:
          type: string
          example: member_JkL012MnO345PqR678
        postThumbnail:
          type: string
          format: uri
        isPublished:
          type: boolean
        includedTags:
          type: array
          items:
            type: string
            example: post_tag_123XyZ456AbC
        postSlug:
          type: string
          example: introducing-summer-collection
        status:
          type: integer
        pageTitle:
          type: string
        pageDescription:
          type: string
        pageKeywords:
          type: string
        socialTitle:
          type: string
        socialDescription:
          type: string
        socialImageUrl:
          type: string
          format: uri
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
    RestEPostCategory:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Category name
          example: Product Updates
    RestRPostCategory:
      type: object
      properties:
        id:
          type: string
          description: Id for the post category
          example: post_category_YzS1wOU20yw87UUHKxMzwn
        name:
          type: string
          description: Name for the post category
          example: Product Updates
        created:
          type: string
          description: Date and time when the post category was created
          format: date-time
        updated:
          type: string
          description: Date and time when the post category was last updated
          format: date-time
    RestEPostTag:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Tag name
          example: Summer Sale
    RestRPostTag:
      type: object
      properties:
        id:
          type: string
          example: post_tag_leBDiFdrUnRmRz4nfopSrv
        name:
          type: string
          description: Tag name
          example: Summer Sale
        created:
          type: string
          description: Date and time when tag was created
          format: date-time
        updated:
          type: string
          description: Date and time when tag was updated
          format: date-time
    RestRMember:
      type: object
      properties:
        id:
          type: string
          example: member_JkL012MnO345PqR678
        email:
          type: string
          format: email
          example: team.member@company.com
        userName:
          type: string
          example: johndoe
        fullName:
          type: string
          example: John Doe
        avatarUrl:
          type: string
          format: uri
          example: https://example.com/avatar.jpg
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
    IdentifyRequest:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
        firstName:
          type: string
        lastName:
          type: string
        company:
          type: string
        customFields:
          type: object
          additionalProperties:
            type: string
        tags:
          type: array
          items:
            type: string
        lists:
          type: array
          items:
            type: string
        newEmail:
          type: string
          format: email
          description: New email when updating existing contact
    IdentifyResponse:
      type: object
      properties:
        status:
          type: string
          example: '200'
        message:
          type: string
          example: OK
    TrackRequest:
      type: object
      properties:
        addTags:
          type: array
          description: Tags to add to contact
          items:
            type: string
        removeTags:
          type: array
          description: Tags to remove from contact
          items:
            type: string
        email:
          type: string
          description: Email address of the contact
          example: test@example.com
    TrackResponse:
      type: object
      properties:
        status:
          type: string
          example: '200'
        message:
          type: string
          example: OK
    WebhookObject:
      type: object
      properties:
        type:
          type: integer
          format: int64
          description: The type of the event.
          example: 7
        time:
          type: integer
          format: int64
          description: The timestamp of the event in milliseconds since the epoch.
          example: 1686304219037565000
        data:
          type: string
          description: Arbitrary data associated with the event.
          example: '{"key": "value"}'
        provider_message_id:
          type: string
          nullable: true
          description: Optional provider message ID.
          example: provider_message_id_123
        campaign_id:
          type: string
          nullable: true
          description: Optional campaign ID.
          example: campaign_id_123
        drip_step_id:
          type: string
          nullable: true
          description: Optional drip step ID.
          example: drip_step_id_123
        rss_exec_id:
          type: string
          nullable: true
          description: Optional RSS execution ID.
          example: rss_exec_id_123
        tag_id:
          type: string
          nullable: true
          description: Optional tag ID.
          example: tag_id_123
        link:
          type: string
          nullable: true
          description: Optional link associated with the event.
          example: https://example.com
        list_id:
          type: string
          nullable: true
          description: Optional list ID.
          example: list_id_123
        contact_id:
          type: string
          nullable: true
          description: Optional contact ID.
          example: contact_id_123
        contact_email:
          type: string
          nullable: true
          description: Optional contact email.
          example: contact@example.com
        custom_field_id:
          type: string
          nullable: true
          description: Optional custom field ID.
          example: custom_field_id_123
        template_id:
          type: string
          nullable: true
          description: Optional template ID.
          example: template_id_123
        popup_id:
          type: string
          nullable: true
          description: Optional popup ID.
          example: popup_id_123
        landing_page_id:
          type: string
          nullable: true
          description: Optional landing page ID.
          example: landing_page_id_123
        form_id:
          type: string
          nullable: true
          description: Optional form ID.
          example: form_id_123
        segment_id:
          type: string
          nullable: true
          description: Optional segment ID.
          example: segment_id_123
        automation_id:
          type: string
          nullable: true
          description: Optional automation ID.
          example: automation_id_123
        drip_id:
          type: string
          nullable: true
          description: Optional drip ID.
          example: drip_id_123
        rss_id:
          type: string
          nullable: true
          description: Optional RSS ID.
          example: rss_id_123
        ab_test_id:
          type: string
          nullable: true
          description: Optional A/B test ID.
          example: ab_test_id_123
        workflow_id:
          type: string
          nullable: true
          description: Optional workflow ID.
          example: workflow_id_123
        workflow_node_id:
          type: string
          nullable: true
          description: Optional workflow node ID.
          example: workflow_node_id_123
        workflow_email_id:
          type: string
          nullable: true
          description: Optional workflow email ID.
          example: workflow_email_id_123
