openapi: 3.0.0
info:
    title: Instasent - Ingest API
    version: 1.0.3
    description: |

        ![Ingest API Diagram](https://instasent.s3.fr-par.scw.cloud/api-assets/ingest/Instasent%20-%20INGEST%20OVERVIEW.png)

        ### Overview
        The Instasent Ingest API is a powerful tool to import **contacts** and **events** into your project. This API allows organizations to consolidate customer data and track interactions, enabling advanced audience segmentation and personalized marketing.

        #### What is the Ingest API?
        The Ingest API is a small subset of the Product API that enables you to **add or update contact data and record events** for each contact within your Instasent project. It functions as an independent Data Source within your project's unified audience, having priority over other data sources when conflicts arise. This setup allows for seamless centralization of customer data, enhancing your understanding of customer behavior and engagement.

        - **Contacts**: Represent individuals in your audience, such as customers, leads, or other relevant profiles.
        - **Events**: Document interactions by these contacts, such as purchases, email opens, clicks, or other custom activities (e.g., "viewed product" or "made a reservation").

        #### Why use the Ingest API?
        Using the Ingest API, businesses can:
        1. **Unify Customer Data**: Consolidate data from various sources into Instasent, creating a 360º view of each contact. Data from this API takes precedence over other sources in cases of overlapping information.
        2. **Automate Data Updates**: Automatically sync new or updated data from external platforms (e.g., CRM, e-commerce).
        3. **Enable Targeted Marketing**: Segment audiences based on attributes or recorded events to enable precise targeting in campaigns.
        4. **Track Engagements**: Record customer interactions to measure engagement and improve marketing strategies.

        #### Key Functionalities
        1. **Create or Update Contacts**:
           - The `/stream/contacts` endpoint allows bulk uploading of contact data, handling up to 100 contacts per request. Existing contacts are updated unless fields are explicitly left blank or set to null.

        2. **Delete Contacts**:
           - Use the `/stream/contacts/{userId}` endpoint to delete a contact, permanently removing their profile from your audience.

        3. **Add Events**:
           - The `/stream/events` endpoint records contact interactions like purchases, views, or other actions. Note that events are immutable and cannot be updated once created.

        4. **Get Stream Information**:
           - The `/stream` endpoint returns information about the stream, including organization, project, and datasource details along with usage statistics.

        5. **Get Attributes and Events Specs**:
           - The `/stream/specs/attributes` and `/stream/specs/events` endpoints provide detailed information about the attributes and events supported by the Ingest API, including data types, validation rules, and other specifications.

        6. **Get Event Parameters Specs**:
           - The `/stream/specs/event-parameters/{eventType}` endpoint provides detailed information about the parameters supported for a specific event type.

        #### Who Should Use This API?
        - **Marketers and CRM Managers**: Automate segmentation and targeting of contacts based on real-time data.
        - **Developers and Data Integrators**: Seamlessly connect Instasent with CRM, e-commerce, or other data systems for continuous updates and customer insights.

        #### Example Use Case
        Suppose a customer makes a purchase on your website. Your e-commerce system sends this purchase event to Instasent using the Ingest API. Instasent updates the contact's profile and triggers any automations you have set up, such as a thank-you SMS. This event is stored in the contact's timeline, helping your team understand the customer's journey.

        #### Technical Notes
        - **API Token**: The Ingest API requires a unique token for secure access. Each data source has its own token.
        - **Rate Limits**: Requests are rate-limited according to your subscription plan.

        #### Useful Links
        1. **Instasent APIs Overview**: Check [our diagram](https://lucid.app/publicSegments/view/e2941f34-b88e-4b96-a7f8-af65e1bf9dc8/image.png)
        2. **Instasent API Docs**: Visit [https://docs.instasent.com](https://docs.instasent.com) to discover all our available APIs
        3. **Ingest API Samples**: Check [our repo](https://gitlab.com/instasent-public/api-ingest-samples)

    contact:
        email: dev@instasent.com
        url: https://instasent.com
        name: Instasent
externalDocs:
    url: https://docs.instasent.com
    description: Access to external documentation
servers:
    - url: https://api.instasent.com/v1/project/{project}/datasource/{datasource}
      description: Instasent Webhooks - Ingest API
      variables:
          project:
              default: project
              description: Project identifier
          datasource:
              default: id
              description: Datasource identifier
security:
    - BearerAuth: []
paths:
    # Stream
    /stream/contacts:
        post:
            summary: Create or update contacts
            description: Use this endpoint to load contacts into your data source. Up to 100 contacts can be sent per call (depending on your subscription plan). Any existing contact will be updated with the new information. Missing attributes will not be overwritten unless you explicitly send a null value for them.
            tags:
                - contacts
            requestBody:
                $ref: '#/components/requestBodies/DatasourceStreamContactsCreateBody'
            responses:
                '202':
                    description: 'Items accepted'
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ResponseCreateDetail'
                '400':
                    $ref: '#/components/responses/WrongRequestError'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '404':
                    $ref: '#/components/responses/NotFound'
                '422':
                    $ref: '#/components/responses/AllFailedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

    /stream/contacts/{userId}:
        delete:
            summary: Delete single contact
            description: Use this endpoint to delete a contact from your data source. Contacts will be permanently destroyed and removed from your audience.
            tags:
                - contacts
            parameters:
                - name: userId
                  in: path
                  description: User id
                  required: true
                  schema:
                      type: string
            responses:
                '202':
                    description: 'Contacts deleted'
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ResponseCreateDetail'
                '400':
                    $ref: '#/components/responses/WrongRequestError'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '404':
                    $ref: '#/components/responses/NotFound'
                '422':
                    $ref: '#/components/responses/AllFailedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'


    /stream/events:
        post:
            summary: Create contact events
            description: |
                Use this endpoint to create past, present, or future events for your contacts. Note that events are not updateable once they are created.

                You can optionally include contact data within the event using the `_user_data` parameter. If provided, the contact will be automatically created or updated before processing the event, eliminating the need for a separate call to the contacts endpoint.
            tags:
                - events
            requestBody:
                $ref: '#/components/requestBodies/DatasourceStreamEventsCreateBody'
            responses:
                '202':
                    description: 'Items accepted'
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ResponseCreateDetail'
                '400':
                    $ref: '#/components/responses/WrongRequestError'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '404':
                    $ref: '#/components/responses/NotFound'
                '422':
                    $ref: '#/components/responses/AllFailedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

    /stream:
        get:
            summary: Get stream information
            description: Returns information about the stream, including organization, project, and datasource details along with usage statistics. Use this one for auth validation.
            tags:
                - specifications
            responses:
                '200':
                    description: 'Stream information and statistics'
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    organization:
                                        $ref: '#/components/schemas/OrganizationInfo'
                                    stream:
                                        $ref: '#/components/schemas/StreamInfo'
                                    datasource:
                                        $ref: '#/components/schemas/DatasourceInfo'
                                    project:
                                        $ref: '#/components/schemas/ProjectInfo'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

    /stream/specs/attributes:
        get:
            summary: Get available contact attributes
            description: Returns the list of available attributes that contacts can have, including their data types and validation rules.
            tags:
                - specifications
            responses:
                '200':
                    description: 'List of available attributes'
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    specs:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/AttributeSpec'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

    /stream/specs/events:
        get:
            summary: Get available event types
            description: Returns the list of available event types that can be tracked.
            tags:
                - specifications
            responses:
                '200':
                    description: 'List of available event types'
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    specs:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/EventTypeSpec'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

    /stream/specs/event-parameters/{eventType}:
        get:
            summary: Get parameters for event type
            description: Returns the list of available parameters for a specific event type.
            tags:
                - specifications
            parameters:
                - name: eventType
                  in: path
                  description: Event type identifier
                  required: true
                  schema:
                      type: string
            responses:
                '200':
                    description: 'List of available parameters for the event type'
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    specs:
                                        type: array
                                        items:
                                            $ref: '#/components/schemas/EventParameterSpec'
                '401':
                    $ref: '#/components/responses/UnauthorizedError'
                '404':
                    $ref: '#/components/responses/NotFound'
                '429':
                    $ref: '#/components/responses/RateLimitError'
                '500':
                    $ref: '#/components/responses/InternalError'

components:
    securitySchemes:
        BearerAuth:
            type: http
            scheme: bearer
            description: Ingest API token for the datasource. This token is specific for the datasource.

    requestBodies:
        # Contact
        DatasourceStreamContactsCreateBody:
            description: |
                An array of contacts to create or update. Up to 100 contacts per request.

                ### Contact data
                You should provide as much contact data as possible. Remember you can use all the contact data to create custom segments, track your customers and get detailed analytics about their behaviour.

                Please be noticed that these are all default contact attributes, which should fit almost any project type. You can add custom attributes to send additional information that suits your particular business logic.

            required: true
            content:
                application/json:
                    schema:
                        type: array
                        minItems: 1
                        maxItems: 100
                        items:
                            $ref: '#/components/schemas/ContactData'

        DatasourceStreamEventsCreateBody:
            description: |
                An array events to create. Up to 100 events per request. Events cannot be updated. Samples don't include all parameters available. Check your API Datasource details for detailed specifications for each event type.

                ### Contact handling
                When sending events, you have two options for handling the associated contact:

                1. **Event for existing contact** (Basic usage)
                   - Only send the `_user_id` parameter
                   - The event will only be processed if the contact exists and is not deleted
                   - If the contact doesn't exist, the event will be silently skipped
                   - Example:
                     ```json
                     {
                         "_user_id": "USER123",
                         "_event_id": "EV123",
                         "_event_type": "...",
                         "_event_parameters": {...}
                     }
                     ```

                2. **Event with embedded contact data** (Advanced usage)
                   - Send both `_user_id` and `_user_data` parameters
                   - The contact will be automatically created or updated before processing the event, data will be merged with existing contact data, you can omit any attribute you don't want to update.
                   - If the contact exists, it will be updated with the new data
                   - If the contact doesn't exist, it will be created
                   - If there's an error creating/updating the contact, the event will be skipped
                   - Example:
                     ```json
                     {
                         "_user_id": "USER123",
                         "_user_data": {
                             "_first_name": "John",
                             "_last_name": "Smith",
                             "_email": "john.smith@example.com",
                             "_phone_mobile": "+34666555444",
                             "_country_code": "ES",
                             "_city": "Madrid",
                             "_language_code": "es",
                             "_client_tags": ["vip-customer", "early-adopter"]
                         },
                         "_event_id": "EV123",
                         "_event_type": "...",
                         "_event_parameters": {...}
                     }
                     ```

                ### Events attribution
                Most events support attribution parameters that provide context about the actions that originated them. For example, attribution parameters are used to track which marketing campaigns led to sales. When we receive an event for a user, we automatically analyze recent communications and user behavior and inject attribution parameters into the event, so you can track the message or campaign that had an impact on it.

                However, it is also possible to handle attribution yourself by sending a non-null, non-empty utm-source parameter with the event. For example: {utm-source: 'my-source'}. Just be aware that in this case, all attribution logic is up to you and we will not be able to attribute events to campaigns, automations, or messages sent through Instasent if you do not specifically send the attribution parameters of the campaign.

                Feel free to send your own attribution parameters if you are certain of the source that should be credited. For example, you might want to attribute sales to campaigns you have run on social media or on other platforms. Do not hesitate to use your own attribution parameters in these cases.

                These are the attribution parameters we set in case we detect the event is the result of a communication sent through Instasent:
                  - `utm-source`: `instasent`
                  - `utm-medium`: Channel [sms|email|...]
                  - `utm-campaign`: Instasent campaign name
                  - `utm-id`: Instasent campaign ID
                  - `utm-content`: A/B Test option sent [option_0, option_1, winner]
                  - `utm-type`: [campaign|direct]
                  - `utm-purpose`: [standard|automation|direct|legacy|api_sms]

                For your convenience, all short links generated from our campaigns/automations include all relevant utm-parameters. These parameters can be saved in the user session (for example, using cookies) and sent to us for every event the user generates during the time period you want.

                Additionally, there are two attribution parameters that we do not use and are available for you in case you do not want to interfere with our automatic attribution mechanism but need to add more attribution information.
                  - `utm-term`: string
                  - `utm-value`: integer

                For a full list of events and parameters, visit your Webhook Datasource details on Instasent.
            required: true
            content:
                application/json:
                    schema:
                        type: array
                        minItems: 1
                        maxItems: 100
                        items:
                            type: object
                            properties:
                                _user_id:
                                    title: User ID
                                    description: Unique user ID of the contact that is producing the event. The contact must exist if no `_user_data` is provided.
                                    type: string
                                    maximum: 40
                                _user_data:
                                    title: Contact Data
                                    description: Optional contact data to create or update the contact before processing the event. Uses the same schema as the contacts endpoint.
                                    $ref: '#/components/schemas/ContactData'
                                _event_id:
                                    title: Event ID
                                    description: Your event identifier, the combination of _event_id + _event_type must be unique or it will be rejected. Additionally, every ingested event gets an internal sequential ID which is not exposed.
                                    type: string
                                    maximum: 40
                                _event_date:
                                    title: Event date
                                    description: "Date of the event, can be past, current or future date. Will default to current date if not set. All events also have an automatic import date to track when it was sent. Format ISO8601 i.e: 2022-11-14T14:21:07+02:00"
                                    type: string
                                    default: Current date
                                    example: "2022-11-14T14:21:07+02:00"
                                _event_type:
                                    title: Event type
                                    description: One of the available event types. Event parameters will vary based on the event type. Go to your API Datasource details on Instasent for a complete reference of parameters, data types and validation for each event type. Some eevnt parameters may even be mandatory.
                                    type: string
                                    example: "generic"
                                    enum:
                                        - generic
                                        - custom
                                        - action
                                        - view
                                        - active
                                        - click
                                        - appointment
                                        - payment
                                        - refund
                                        - chargeback
                                        - invoice
                                        - lead
                                        - metric
                                        - form_view
                                        - form_submit
                                        - ecommerce_product_view
                                        - ecommerce_product_add
                                        - ecommerce_product_purchase
                                        - ecommerce_checkout_init
                                        - ecommerce_checkout_cancel
                                        - ecommerce_checkout_update
                                        - ecommerce_checkout_abandon
                                        - ecommerce_order_create
                                        - ecommerce_order_update
                                        - ecommerce_order_pay
                                        - ecommerce_order_ship
                                        - ecommerce_order_deliver
                                        - ecommerce_order_cancel
                                        - ecommerce_order_refund
                                        - ecommerce_order_chargeback
                                        - ecommerce_coupon_created
                                        - ecommerce_coupon_used
                                        - ecommerce_coupon_removed
                                        - ecommerce_stock_subscribe
                                        - ecommerce_stock_restock
                                        - deal_add
                                        - deal_update
                                        - deal_won
                                        - deal_lost
                                        - meeting_registered
                                        - meeting_canceled
                                        - meeting_joined
                                        - meeting_left
                                _event_parameters:
                                    type: object
                            required:
                                - _event_type
                                - _event_id
                                - _user_id
                                - _event_parameters
                    examples:
                        generic:
                            summary: 'Generic event'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: generic
                                  _event_parameters:
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-event-source
                                      name: my-event-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      date: "2023-02-06T11:41:35+02:00"
                                      detail: 'This is some non-searchable detail'
                        generic_with_embedded_contact:
                            summary: 'Generic event with embedded contact'
                            value:
                                - _user_id: BX-1001
                                  _user_data:
                                      _first_name: "John"
                                      _last_name: "Smith"
                                      _email: "john.smith@example.com"
                                      _phone_mobile: "+34666555444"
                                      _country_code: "ES"
                                      _city: "Madrid"
                                      _language_code: "es"
                                      _client_tags: ["vip-customer", "early-adopter"]
                                      _date_registered: "2023-01-15T10:00:00+01:00"
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: generic
                                  _event_parameters:
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-event-source
                                      name: my-event-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      date: "2023-02-06T11:41:35+02:00"
                                      detail: 'This is some non-searchable detail'
                        generic_attribution:
                            summary: 'Generic event (Custom attribution)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: generic
                                  _event_parameters:
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-event-source
                                      name: my-event-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      date: "2023-02-06T11:41:35+02:00"
                                      detail: 'This is some non-searchable detail'
                                      utm-source: 'my-utm-source'
                                      utm-medium: 'my-utm-medium'
                                      utm-campaign: 'my-utm-campaign'
                                      utm-term: 'my-utm-term'
                                      utm-content: 'my-utm-content'
                                      utm-value: 1234
                        action:
                            summary: 'Action performed'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: action
                                  _event_parameters:
                                      action: action-that-has-been-performed
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      date: "2023-02-06T11:41:35+02:00"
                                      detail: 'This is some non-searchable detail'
                        action_attribution:
                            summary: 'Action performed (Custom attribution)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: action
                                  _event_parameters:
                                      action: action-that-has-been-performed
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      date: "2023-02-06T11:41:35+02:00"
                                      detail: 'This is some non-searchable detail'
                        click:
                            summary: 'Click on link / button'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: click
                                  _event_parameters:
                                      target: clicked-target-or-dom-element-id
                                      type: my-event-subtype
                                      category: my-category
                                      id: GR-012356789
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                        viewed:
                            summary: 'Viewed / Visited'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: view
                                  _event_parameters:
                                      platform: desktop
                                      target: target
                                      type: item-type
                                      category: item-category
                                      id: id-or-reference-of-viewed-item
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                        metric:
                            summary: 'Metric / Analytic'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: metric
                                  _event_parameters:
                                      type: metric-type
                                      category: metric-category
                                      id: id-or-reference-of-metric
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                        lead:
                            summary: 'Lead / Conversion (Automatic attribution)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: lead
                                  _event_parameters:
                                      type: lead-type
                                      category: lead-category
                                      id: id-or-reference-of-lead
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      detail: 'This is some non-searchable detail'
                                      is-first: true
                        lead_attribution:
                            summary: 'Lead / Conversion (Custom attribution)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: lead
                                  _event_parameters:
                                      type: lead-type
                                      category: lead-category
                                      id: id-or-reference-of-lead
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      detail: 'This is some non-searchable detail'
                                      is-first: true
                                      utm-source: 'my-utm-source'
                                      utm-medium: 'my-utm-medium'
                                      utm-campaign: 'my-utm-campaign'
                                      utm-term: 'my-utm-term'
                                      utm-content: 'my-utm-content'
                                      utm-value: 1234
                        appointment:
                            summary: 'Appointment / Reservation'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: appointment
                                  _event_parameters:
                                      type: appointment-type
                                      category: appointment-category
                                      id: id-or-reference-of-appointment
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      value: 150
                                      amount: 10.88
                                      amount-currency: USD
                                      detail: 'This is some non-searchable detail'
                                      appointment-date: "2022-11-18T20:15:00+02:00"
                                      appointment-all-day: false
                                      appointment-duration: 120
                                      appointment-seats: 6
                        payment:
                            summary: 'Generic payment (non-ecommerce)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: payment
                                  _event_parameters:
                                      type: appointment-type
                                      category: appointment-category
                                      source: my-generic-source
                                      name: my-generic-name
                                      tags: [tag-one, tag-two, tag-three]
                                      detail: 'This is some non-searchable detail'
                                      payment-id: id-or-reference-of-payment
                                      payment-date: "2022-11-18T20:15:00+02:00"
                                      payment-is-paid: true
                                      payment-currency: USD
                                      # Total = Subtotal - Discount + Handling
                                      payment-profit: 98.68
                                      payment-amount: 108.93
                                      payment-subtotal: 105.88
                                      payment-tax: 10.25
                                      payment-handling: 8.40
                                      payment-discount: 5.35
                                      payment-discount-code: 'CUSTOM-CODE-123'
                                      payment-invoice-id: 'MY-INVOICE-23'
                                      payment-method: 'paypal'
                                      payment-method-id: 'paypal-reference-number'
                                      payment-items: ['my-item-1', 'my-item-2']
                                      payment-origin: 'who-made-the-payment'
                                      payment-destination: 'who-received-the-payment'
                                      payment-is-recurrent: true
                                      payment-frequency: monthly
                        invoice:
                            summary: 'Invoice'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: '022-11-15T21:14:53+02:00'
                                  _event_type: invoice
                                  _event_parameters:
                                      created-at: '2023-07-19T14:48:00Z'
                                      utm-source: 'google'
                                      utm-medium: 'cpc'
                                      utm-campaign: 'summer_sale_2023'
                                      utm-term: 'outdoor+gear'
                                      utm-content: 'sidebar_ad_300x250'
                                      utm-id: 'campaign_112'
                                      utm-purpose: 'lead_generation'
                                      utm-type: 'brand_awareness'
                                      utm-value: 2.5
                                      type: 'e-commerce'
                                      category: 'electronics'
                                      source: 'website'
                                      tags: ['sale', 'summer', 'electronics', 'discount']
                                      invoice-is-paid: 'Sí'
                                      invoice-id: 'INV-123456'
                                      invoice-status: 'paid'
                                      payment-id: 'PAY-987654321'
                                      invoice-date: '2023-07-20'
                                      invoice-subtotal: 950.00
                                      invoice-tax: 190.00
                                      invoice-profit: 300.00
                                      invoice-handling: 15.00
                                      invoice-discount: 50.00
                                      invoice-discount-code: 'SUMMER2023'
                                      invoice-amount: 1105.00
                                      invoice-currency: 'USD'
                                      invoice-method: 'credit_card'
                                      invoice-method-id: 'CC-01XYZ'
                                      invoice-items: ['Smartphone Model X', 'Bluetooth Headphones', 'Portable Charger']
                                      invoice-recipient: 'John Doe'
                                      invoice-issuer: 'Electronics World Inc.'
                                      invoice-is-recurrent: 'No'
                                      invoice-frequency: 'One-time'
                                      invoice-detail: 'Invoice for your recent purchase at Electronics World. Thank you for your business.'
                                      invoice-url: 'https://example.com/invoice/INV-123456'

                        campaign_send:
                            summary: 'Campaign sent / delivered'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: '022-11-15T21:14:53+02:00'
                                  _event_type: campaign_send
                                  _event_parameters:
                                      utm-source: "newsletter"
                                      utm-medium: "email"
                                      utm-campaign: "back_to_school_sale"
                                      utm-term: "school+supplies"
                                      utm-content: "header_banner"
                                      utm-id: "campaign_209"
                                      utm-purpose: "sales_promotion"
                                      utm-type: "seasonal_offer"
                                      utm-value: 4.5
                                      channel: "email"
                                      id: "CS-20230805-123"
                                      subid: "SUB-567890"
                                      name: "Back to School Blast"
                                      status: "sent"
                                      status-detail: "Delivered to SMTP server"
                                      channel-sent-at: "2023-08-05T11:00:00Z"
                                      channel-chars-count: 1542
                                      channel-messages-count: 1
                                      channel-from: "school.supplies@shop.com"
                                      channel-to: "customer1234@example.com"
                                      channel-country: "US"
                                      channel-network: "Comcast"
                                      channel-carrier: "Gmail"
                                      channel-price-amount: 0.02
                                      channel-price-currency: "USD"
                                      channel-verified: "Sí"

                        campaign_cta:
                            summary: 'Campaign click / Call to action'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: '022-11-15T21:14:53+02:00'
                                  _event_type: campaign_cta
                                  _event_parameters:
                                      utm-source: "social_media"
                                      utm-medium: "twitter"
                                      utm-campaign: "fall_fashion_line"
                                      utm-term: "new+arrivals"
                                      utm-content: "tweet_link"
                                      utm-id: "campaign_401"
                                      utm-purpose: "brand_awareness"
                                      utm-type: "product_launch"
                                      utm-value: 3.7
                                      url: "https://www.example.com/fall-fashion?utm_source=social_media&utm_medium=twitter&utm_campaign=fall_fashion_line"
                                      ip: "192.168.1.1"
                                      country: "Spain"
                                      state: "Madrid"
                                      city: "Madrid"
                                      device: "iPhone 12"
                                      platform: "iOS"
                                      browser: "Safari"
                                      channel: "Social Media"
                                      id: "CMP-20230901-456"
                                      subid: "SUB-789123"
                                      name: "Fall Fashion Line Launch"
                                      is-first: "Sí"
                                      coordinates: "40.416775,-3.703790"
                                      type: "click"
                                      channel-sent-at: "2023-09-01T15:00:00Z"
                                      channel-country: "Spain"
                                      channel-network: "Vodafone"
                                      channel-carrier: "Telefónica"

                        custom:
                            summary: 'Custom event (Free parameters)'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: custom
                                  _event_parameters:
                                      int1: 1
                                      int2: 2
                                      int3: 3
                                      int4: 4
                                      int5: 5
                                      int6: 6
                                      int7: 7
                                      int8: 8
                                      decimal1: 1.1
                                      decimal2: 2.2
                                      decimal3: 3.3
                                      decimal4: 4.4
                                      decimal5: 5.5
                                      decimal6: 6.6
                                      decimal7: 7.7
                                      decimal8: 8.8
                                      decimal9: 9.9
                                      decimal10: 10.10
                                      keyword1: text1
                                      keyword2: text2
                                      keyword3: text3
                                      keyword4: text4
                                      keyword5: text5
                                      keyword6: text6
                                      keyword7: text7
                                      keyword8: text8
                                      keyword9: text9
                                      keyword10: text10
                                      bool1: true
                                      bool2: false
                                      bool3: false
                                      bool4: true
                                      date: "2022-11-18T20:15:00+02:00"
                                      detail1: "My first long text up to 512 chars"
                                      detail2: "My second long text up to 512 chars"
                        ecommerce-order-created-minimal:
                            summary: 'E-commerce: Order created - Minimal data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_create
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-currency: 'USD'
                                      order-amount: 123.93
                        ecommerce-order-created-recommended:
                            summary: 'E-commerce: Order created - Recommended data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_create
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-url: 'https://example.com/view_order?order_id=ORD-1500001'
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-taxonomy: ['Food, Beverages & Tobacco > Beverages > Soda', 'Food, Beverages & Tobacco > Food Items > Dairy Products > Cheese', 'Food, Beverages & Tobacco > Food Items > Pasta & Noodles']
                                      product-category: ['beverage', 'food', 'food']
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                        ecommerce-order-created-all:
                            summary: 'E-commerce: Order created - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_create
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-distinct-products: 3
                                      order-url: 'https://example.com/view_order?order_id=ORD-1500001'
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-vendor: ['Nestle', 'Kraft', 'Barilla']
                                      product-taxonomy: ['Food, Beverages & Tobacco > Beverages > Water', 'Food, Beverages & Tobacco > Food Items > Dairy Products > Cheese', 'Food, Beverages & Tobacco > Food Items > Pasta & Noodles']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['drink', 'water', 'pasta', 'italian', 'dairy', 'cheese', 'mediterranean', 'family-pack']
                                      product-collections: ['winter-sale','last-units']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-unit: [10.1, 8.4, 3.98]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                                      utm-source: 'my-utm-source'
                                      utm-medium: 'my-utm-medium'
                                      utm-campaign: 'my-utm-campaign'
                                      utm-term: 'my-utm-term'
                                      utm-content: 'my-utm-content'
                                      utm-value: 1234
                        ecommerce-order-update-all:
                            summary: 'E-commerce: Order updated - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_update
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-distinct-products: 3
                                      order-url: 'https://example.com/view_order?order_id=ORD-1500001'
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-vendor: ['Nestle', 'Kraft', 'Barilla']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['drink', 'water', 'pasta', 'italian', 'dairy', 'cheese', 'mediterranean', 'family-pack']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-unit: [10.1, 8.4, 3.98]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                                      update-status: 'new status'
                                      update-add: ['what-has-been-added-1', 'what-has-been-added-2']
                                      update-change: ['something-that-has-changed-1', 'something-that-has-changed-2']
                        ecommerce-order-cancelled:
                            summary: 'E-commerce: Order cancelled - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_cancel
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-distinct-products: 3
                                      order-url: 'https://example.com/view_order?order_id=ORD-1500001'
                                      cancel-reason: 'cancellation-reason'
                                      cancel-refund: true
                                      cancel-refund-currency: 'USD'
                                      cancel-refund-amount: 123.93
                        ecommerce-order-paid:
                            summary: 'E-commerce: Order paid - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_pay
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-distinct-products: 3
                                      order-url: 'https://example.com/view_order?order_id=ORD-1500001'
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['these', 'are', 'the', 'combined', 'tags', 'for', 'all', 'ordered', 'products']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-unit: [10.1, 8.4, 3.98]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                                      payment-name: 'paypal'
                                      payment-method: 'credit-card'
                                      payment-gateway: 'visa'
                                      payment-currency: 'USD'
                                      payment-amount: 123.93
                        ecommerce-order-shipped:
                            summary: 'E-commerce: Order shipped - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_order_ship
                                  _event_parameters:
                                      order-id: 'ORD-1500001'
                                      order-is-first: true
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      order-profit: 98.68
                                      order-subtotal-amount: 105.88
                                      order-discount-amount: 5.35
                                      order-shipping-amount: 5.00
                                      order-handling-amount: 10.00
                                      order-tax-amount: 10.25
                                      order-discount-code: 'DISCOUNT-001'
                                      order-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      order-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      order-distinct-products: 3
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['these', 'are', 'the', 'combined', 'tags', 'for', 'all', 'ordered', 'products']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      shipping-method: 'UPS next day'
                                      shipping-company: 'UPS'
                                      shipping-id: 'XP039402342WQ'
                                      shipping-name: 'UPS'
                                      shipping-tracking-number: '1Z999AA10123456784'
                                      shipping-tracking-url: 'https://www.ups.com/track?id=1Z999AA10123456784'
                                      shipping-delivery-note: 'Delivery instructions up to 512 chars'
                                      shipping-delivery-date: '2022-11-16'
                                      shipping-packages: 2
                                      shipping-weight-kilo: 8.23
                        ecommerce-checkout-started:
                            summary: 'E-commerce: Checkout started - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_chekout_init
                                  _event_parameters:
                                      checkout-id: 'CKO-1500001'
                                      checkout-is-first: true
                                      checkout-currency: 'USD'
                                      checkout-amount: 123.93
                                      checkout-profit: 98.68
                                      checkout-subtotal-amount: 105.88
                                      checkout-discount-amount: 5.35
                                      checkout-shipping-amount: 5.00
                                      checkout-handling-amount: 10.00
                                      checkout-tax-amount: 10.25
                                      checkout-discount-code: 'DISCOUNT-001'
                                      checkout-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      checkout-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      checkout-distinct-products: 3
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-taxonomy: ['Food, Beverages & Tobacco > Beverages > Soda', 'Food, Beverages & Tobacco > Food Items > Dairy Products > Cheese', 'Food, Beverages & Tobacco > Food Items > Pasta & Noodles']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['these', 'are', 'the', 'combined', 'tags', 'for', 'all', 'ordered', 'products']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-unit: [10.1, 8.4, 3.98]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                                      checkout-url: 'https://example.com/url_to_recover_the_checkout_and_place_the_order'
                        ecommerce-checkout-updated:
                            summary: 'E-commerce: Checkout updated - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_chekout_update
                                  _event_parameters:
                                      checkout-id: 'CKO-1500001'
                                      checkout-is-first: true
                                      checkout-currency: 'USD'
                                      checkout-amount: 123.93
                                      checkout-profit: 98.68
                                      checkout-subtotal-amount: 105.88
                                      checkout-discount-amount: 5.35
                                      checkout-shipping-amount: 5.00
                                      checkout-handling-amount: 10.00
                                      checkout-tax-amount: 10.25
                                      checkout-discount-code: 'DISCOUNT-001'
                                      checkout-refs: ['MY-WAREHOUSE-A-HANDLING-75023', 'MY-SUPPLIER-ORDER-501206']
                                      checkout-tags: ['fastshipping', 'paid-with-paypal', 'warehouse-a', 'black-friday-offers']
                                      checkout-distinct-products: 3
                                      product-id: ['e17a6466617', 'bb661205f242424', '7fa7d64666ae']
                                      product-name: ['Water bottle 500ml', 'Cheese', 'Spaghetti pack x3']
                                      product-category: ['beverage', 'food', 'food']
                                      product-tags: ['these', 'are', 'the', 'combined', 'tags', 'for', 'all', 'ordered', 'products']
                                      product-sku: ['WAT0AF1', 'CHE401ZX', 'SPA88XCL']
                                      product-uid: ['water-0af1', 'cheese-401zx', 'spaghetti-88xcl']
                                      product-count: [8, 3, 1]
                                      product-price-unit: [10.1, 8.4, 3.98]
                                      product-price-total: [80.4, 36.3, 8.6]
                                      product-price-discount: [0, 3.3, 0]
                                      product-image: ['https://example.com/my-product-1.jpg', 'https://example.com/my-product-2.jpg', 'https://example.com/my-product-3.jpg']
                                      checkout-url: 'https://example.com/url_to_recover_the_checkout_and_place_the_order'
                        ecommerce-checkout-cancelled:
                            summary: 'E-commerce: Checkout cancelled - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_chekout_cancelled
                                  _event_parameters:
                                      checkout-id: 'CKO-1500001'
                                      detail: 'Details about cancellation. Up to 512 chars'
                        ecommerce-coupon-created:
                            summary: 'E-commerce: Coupon created - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_coupon_created
                                  _event_parameters:
                                      coupon-code: 'SAVE10'
                                      coupon-name: 'Welcome 10% Off'
                                      coupon-type: 'loyalty'
                                      coupon-category: 'customer_retention'
                                      coupon-tags: ['welcome', 'new-customer', 'discount']
                                      coupon-value: 10.00
                                      coupon-percentage: '10'
                                      coupon-currency: USD
                                      coupon-expiration-date: '2023-12-31'
                                      coupon-min-order-amount: 50.00
                                      coupon-max-uses: 100
                                      coupon-url: 'https://example.com/redeem/SAVE10'
                                      coupon-description: '10% discount for new customers'
                                      coupon-custom-1: 'vip-customers'
                                      coupon-custom-2: 'black-friday-2023'
                                      coupon-custom-3: 'referral-program'
                                      product-categories: ['electronics', 'home', 'appliances']
                                      product-tags: ['best-seller', 'featured', 'sale']
                        ecommerce-coupon-used:
                            summary: 'E-commerce: Coupon used - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_coupon_used
                                  _event_parameters:
                                      coupon-code: 'SAVE10'
                                      coupon-name: 'Welcome 10% Off'
                                      coupon-value: 0
                                      coupon-percentage: '10'
                                      order-id: 'ORD-1500001'
                                      order-currency: 'USD'
                                      order-amount: 123.93
                                      coupon-discount-applied: 13.77
                                      order-original-amount: 137.70
                                      order-discount-amount: 13.77
                        ecommerce-coupon-removed:
                            summary: 'E-commerce: Coupon removed - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_coupon_removed
                                  _event_parameters:
                                      coupon-code: 'SAVE10'
                                      coupon-name: 'Welcome 10% Off'
                                      coupon-removal-reason: 'expired'
                        ecommerce-back-in-stock-subscribe:
                            summary: 'E-commerce: Back in stock subscription - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_stock_subscribe
                                  _event_parameters:
                                      product-id: 'PROD-12345'
                                      product-name: 'Wireless Headphones Pro'
                                      product-vendor: 'TechBrand'
                                      product-category: 'Electronics'
                                      product-taxonomy: ['Electronics', 'Audio', 'Headphones']
                                      product-tags: ['wireless', 'premium', 'bluetooth']
                                      product-collections: ['Audio', 'Featured']
                                      product-sku: 'WH-PRO-12345'
                        ecommerce-back-in-stock-restock:
                            summary: 'E-commerce: Back in stock restock - All available data'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: ecommerce_stock_restock
                                  _event_parameters:
                                      product-id: 'PROD-12345'
                                      product-name: 'Wireless Headphones Pro'
                                      product-vendor: 'TechBrand'
                                      product-category: 'Electronics'
                                      product-taxonomy: ['Electronics', 'Audio', 'Headphones']
                                      product-tags: ['wireless', 'premium', 'bluetooth']
                                      product-collections: ['Audio', 'Featured']
                                      product-sku: 'WH-PRO-12345'
                        active:
                            summary: 'Active on site'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: active
                                  _event_parameters:
                                      ip: '127.0.0.1'
                                      browser: 'Google Chrome'
                                      device: 'Google Pixel 8'
                                      platform: 'Mobile'
                                      country: 'ES'
                                      target: 'website'
                                      url: 'https://example.com'
                        view:
                            summary: 'Viewed / Visited'
                            value:
                                - _user_id: BX-1001
                                  _event_id: EV-75901
                                  _event_date: "2022-11-15T21:14:53+02:00"
                                  _event_type: view
                                  _event_parameters:
                                      ip: '127.0.0.1'
                                      browser: 'Google Chrome'
                                      device: 'Google Pixel 8'
                                      platform: 'Mobile'
                                      country: 'ES'
                                      type: 'product'
                                      category: 'my-category'
                                      id: 'GR-012356789'
                                      target: 'Product 001'
                                      url: 'https://example.com'
    schemas:
        # Valid responses:
        ResponseCreateDetail:
            type: object
            properties:
                success:
                    type: boolean
                status:
                    type: integer
                errors:
                    title: Rejected items
                    type: array
                    items:
                        type: object
                        properties:
                            position:
                                type: integer
                                description: Item index within the sent array
                            error:
                                type: string
                                description: Error description
                            item:
                                type: object
                                description: Item data you sent
                accepted:
                    title: Accepted items
                    type: array
                    items:
                        type: object
                        properties:
                            position:
                                type: integer
                                description: Item index within the sent array
                            item:
                                type: object
                                description: Saved item data
                streamId:
                    type: string
                projectId:
                    type: string
                projectUid:
                    type: string
                datasourceId:
                    type: string
                datasourceUid:
                    type: string
                entitiesSuccess:
                    type: integer
                entitiesFailures:
                    type: integer
                stats:
                    type: object
                    properties:
                        callsTotal:
                            type: integer
                        callsSuccess:
                            type: integer
                        callsFailures:
                            type: integer
                        entitiesSuccess:
                            type: integer
                        entitiesFailures:
                            type: integer
        # Errors
        ResponseErrorDetail:
            type: object
            properties:
                title:
                    type: string
                status:
                    type: integer
                detail:
                    type: string
            required:
                - title
                - status
                - detail
        ResponseErrorMessage:
            type: object
            properties:
                message:
                    type: string
                code:
                    type: integer
            required:
                - message

        AttributeSpec:
            type: object
            properties:
                requiredInWebhook:
                    type: boolean
                important:
                    type: boolean
                uid:
                    type: string
                adhocUid:
                    type: string
                    nullable: true
                description:
                    type: string
                dataType:
                    type: string
                visualType:
                    type: string
                readonly:
                    type: boolean
                visible:
                    type: boolean
                custom:
                    type: boolean
                unique:
                    type: boolean
                displayLabel:
                    type: string
                multivalue:
                    type: integer
                createdByDatasourceType:
                    type: string
                    nullable: true
                createdByDatasourceUid:
                    type: string
                    nullable: true
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time

        EventTypeSpec:
            type: object
            properties:
                uid:
                    type: string
                name:
                    type: string
                description:
                    type: string
                category:
                    type: string
                attribution:
                    type: boolean
                automation:
                    type: boolean
                icon:
                    type: string
                emoji:
                    type: string
                important:
                    type: boolean

        EventParameterSpec:
            type: object
            properties:
                parameter:
                    type: string
                title:
                    type: string
                description:
                    type: string
                icon:
                    type: string
                dataType:
                    type: string
                visualType:
                    type: string
                maxLength:
                    type: integer
                required:
                    type: boolean
                multiValue:
                    type: integer

        OrganizationInfo:
            type: object
            properties:
                id:
                    type: string
                name:
                    type: string
                plan:
                    type: string
                quality:
                    type: integer

        StreamInfo:
            type: object
            properties:
                exposed:
                    type: boolean
                id:
                    type: string
                type:
                    type: string
                purpose:
                    type: string
                    nullable: true
                callsTotal:
                    type: integer
                callsSuccess:
                    type: integer
                callsFailures:
                    type: integer
                processedEntitiesSuccess:
                    type: integer
                processedEntitiesFailures:
                    type: integer
                lastSuccessTime:
                    type: string
                    format: date-time
                    nullable: true
                lastFailureTime:
                    type: string
                    format: date-time
                    nullable: true
                lastCallTime:
                    type: string
                    format: date-time
                    nullable: true

        DatasourceInfo:
            type: object
            properties:
                name:
                    type: string
                id:
                    type: string
                uid:
                    type: string
                type:
                    type: string
                integration:
                    type: string
                    nullable: true
                sequence:
                    type: integer
                priority:
                    type: integer
                locale:
                    type: string
                timezone:
                    type: string
                defaultCountry:
                    type: string
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time

        ProjectInfo:
            type: object
            properties:
                locale:
                    type: string
                timezone:
                    type: string
                name:
                    type: string
                id:
                    type: string
                uid:
                    type: string
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time

        ContactData:
            type: object
            properties:
                _user_id:
                    title: Unique user id
                    description: Ensure to provide an unique user id for each contact. Contacts with the same user id will be merged automatically within your project, even if they belong to different datasources.
                    type: string
                    maximum: 40
                _first_name:
                    title: First name
                    type: string
                    maximum: 40
                _last_name:
                    title: Last name
                    type: string
                    maximum: 40
                _full_name:
                    title: Full name
                    description: Will be automatically generated from first name + last name if not sent.
                    type: string
                    maximum: 128
                _phone_mobile:
                    title: Mobile phone
                    description: Must include country code. It will be enforced to be a valid mobile phone and suitable for sending SMS campaings. If it's not a valid mobile phone, it will be automatically saved as _phone_other attribute.
                    type: string
                    maximum: 40
                _email:
                    title: Email address
                    type: string
                    maximum: 128
                _client_tags:
                    title: Tags
                    description: Array of client provided tags to categorize the contact, each item must be a lowercase string without spaces.
                    type: array
                    items:
                        type: string
                _date_registered:
                    title: Registration date
                    description: "Date of customer registration within the datasource. Will default to import date if not set. Format ISO8601 i.e: 2022-11-14T14:21:07+02:00"
                    type: string
                    default: Current date
                    example: "2022-11-14T14:21:07+02:00"
                _country_code:
                    title: Country code
                    description: 2 Letter ISO 3166-1 code, i.e. ES. In case you send a full country name it will be converted automatically.
                    type: string
                    maximum: 2
                    example: "US"
                _gender:
                    title: User gender
                    description: Free format
                    type: string
                    maximum: 40
                _phone_other:
                    title: Other phone
                    description: "Other phone: fixed line / landline, extension, phone without proper format..."
                    type: string
                    maximum: 40
                _ip:
                    title: IP address
                    description: IPv4 or IPv6 address
                    type: string
                    maximum: 40
                _username:
                    title: Username
                    description: If you set up this attribute as unique, contacts will the same value will be merged automatically.
                    type: string
                    maximum: 40
                _language_code:
                    title: Language
                    description: 2 Letter ISO 639-1 code. In case you send a full language name it will be converted automatically.
                    type: string
                    maximum: 40
                    example: "en"
                _state:
                    title: State
                    description: User state / Level-1 subdivision. Not validated.
                    type: string
                    maximum: 40
                _region:
                    title: Region
                    description: User region / province / Level-2 subdivision. Not validated.
                    type: string
                    maximum: 40
                _city:
                    title: City
                    description: User city. Not validated.
                    type: string
                    maximum: 40
                _zipcode:
                    title: Zipcode
                    description: Postal / Zip code. Not validated.
                    type: string
                    maximum: 40
                _address:
                    title: Address
                    description: Postal address
                    type: string
                    maximum: 128
                _user_vat:
                    title: User VAT
                    description: User VAT number for invoices. No validations are made.
                    type: string
                    maximum: 40
                _user_ssn:
                    title: "ID/SSN"
                    description: Social security number or identification code. Country-dependant. Non validated.
                    type: string
                    maximum: 40
                _company:
                    title: Company name
                    description: User company name
                    type: string
                    maximum: 128
                _branch:
                    title: Company branch
                    description: Company branch, office, department, team...
                    type: string
                    maximum: 128
                _company_vat:
                    title: Company VAT
                    description: User company VAT / ID for invoicing.
                    type: string
                _url:
                    title: "Website/Url"
                    description: Company or personal web page. Proper URL with schema (i.e. https://google.com)
                    type: string
                    maximum: 128
                _currency:
                    title: Currency
                    description: "Currency code. 3 Letter ISO 4217 code (i.e: USD, EUR...)"
                    example: USD
                    type: string
                    maximum: 3
                _date_accepts_marketing_email:
                    title: Email mkt. accept date
                    description: "Date of Email marketing acceptance. Format ISO8601 i.e: 2022-11-14"
                    example: "2022-11-14"
                    type: string
                _accepts_marketing_email:
                    title: Accepts mkt. emails?
                    description: Identifies whether the contact has accepted receiving marketing emails. We will not touch this attribute. Use it as customer opt-in in case you are handling it.
                    type: boolean
                    default: true
                _is_subscribed_email:
                    title: Subscribed to emails?
                    description: Instasent email subscription status. Tracks campaigns unsubscriptions. We will set it to false if the contact unsubscribes.
                    type: boolean
                    default: true
                _date_accepts_marketing_sms:
                    title: SMS mkt. accept date
                    description: "Date of SMS marketing acceptance. Format ISO8601 i.e: 2022-11-14"
                    example: "2022-11-14"
                    type: string
                _accepts_marketing_sms:
                    title: Accepts mkt. SMS?
                    description: Identifies whether the contact has accepted receiving marketing SMS. We will not touch this attribute. Use it as customer opt-in in case you are handling it.
                    type: boolean
                    default: true
                _is_subscribed_sms:
                    title: Subscribed to SMS?
                    description: Instasent SMS subscription status. Tracks campaigns unsubscriptions. We will set it to false if the contact unsubscribes.
                    type: boolean
                    default: true
                _date_birthday:
                    title: User birthday
                    description: "Format ISO8601 i.e: 2022-11-14"
                    example: "2022-11-14"
                    type: string
                _geolocation:
                    title: Coordinates
                    description: "Geo coordinates string in GeoJSON Format: '[lon, lat]' brackets included. i.e '[-3.70, 40.41]'"
                    type: string
                    example: "[-3.70, 40.41]"
                _row:
                    title: Row number
                    description: Row number / Position / Generic sequential integer number
                    type: integer
                _is_deleted:
                    title: Archived?
                    description: Mark the contact as archived (soft delete, contacts can be unarchived)
                    type: boolean
                    default: false

    responses:
        # Errors
        WrongRequestError:
            description: You request body is malformed or something went wrong with your request
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorDetail'
        UnauthorizedError:
            description: You are missing or using bad credentials
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorMessage'
        NotFound:
            description: Resource can't be found
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorDetail'
        RequestTooLarge:
            description: You are sending a large body in your request
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorDetail'
        AllFailedError:
            description: All sent items have errors, nothing has been persisted.
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseCreateDetail'
        RateLimitError:
            description: You reached your endpoint rate limit
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorMessage'
        InternalError:
            description: Internal server error
            content:
                application/json:
                    schema:
                        $ref: '#/components/schemas/ResponseErrorMessage'
