openapi: 3.1.0
info:
  version: '2.7'
  title: Batch - REST API
  description: Batch's REST API
  contact:
    name: Batch Support
    url: https://doc.batch.com
    email: support@batch.com
servers:
  - url: https://api.batch.com/{version}
    description: production
    variables:
      version:
        default: '2.7'
        description: Version of the API
tags:
  - name: Profiles
  - name: Audiences
  - name: Campaigns
  - name: Catalogs
  - name: Exports
paths:
  /profiles/export:
    post:
      operationId: profile_export
      tags:
        - Profiles
      summary: Export
      description: Create a request to export profile data.
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              discriminator:
                propertyName: export_type
                mapping:
                  ATTRIBUTES: '#/components/schemas/ExportAttributeRequest'
                  EVENTS: '#/components/schemas/ExportEventRequest'
              anyOf:
                - $ref: '#/components/schemas/ExportAttributeRequest'
                - $ref: '#/components/schemas/ExportEventRequest'
                - $ref: '#/components/schemas/ExportReachabilityRequest'
            examples:
              export_attributes:
                value:
                  export_type: ATTRIBUTES
                  attributes:
                    - $email_address
                    - $language
                    - firstname
                    - is_premium
                  identifiers:
                    - custom_id
                    - installation_ids
                  filter:
                    segment: MY-SEGMENT-CODE
              export_events:
                value:
                  export_type: EVENTS
                  from: '2024-01-01T00:00:00Z'
                  to: now
                  identifiers:
                    - custom_id
                  events:
                    - email_sent
                    - sms_sent
                    - push_sent
              export_reachability:
                value:
                  export_type: REACHABILITY
                  from: '2024-01-01T00:00:00Z'
                  to: now
                  identifiers:
                    - custom_id
                    - installation_id
                  channels:
                    - email
                    - push
                    - sms
      responses:
        '202':
          description: >
            If the POST to the API endpoint is successful you will receive an
            HTTP 202 confirmation and a request id. <br/>Once you get your
            request id, you can use it to check the export request status with
            the <a href="/operations/export_view">export view API endpoint</a>.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      The export id associated with your request to be used to
                      get status.
                    example: export_063bc4w4x8e363yem6wfnxc5c13c0n46
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /profiles/update:
    post:
      operationId: profile_update
      tags:
        - Profiles
      summary: Update
      description: Update one or multiple profile's data and track events
      security:
        - rest_key: []
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkEditProfile'
            examples:
              complete:
                description: >
                  Add the jane.doe@demo.batch.com email address on a profile.
                  Mark them as subscribed to marketing emails to they can
                  receive them. Their locale is en_FR as they're an english
                  speaker living in France. Add some properties about who they
                  are, with one appending to an existing array. Finally, track
                  an "add_to_cart" event with attributes and tags. Rework the
                  event for iOS and don't track it on web.
                value:
                  - identifiers:
                      custom_id: jane.doe@demobatch.com
                    attributes:
                      $email_address: jane.doe@demobatch.com
                      $email_marketing: subscribed
                      $phone_number: '+33182837140'
                      $sms_marketing: unsubscribed
                      $language: en
                      $region: FR
                      $timezone: Europe/Paris
                      firstname: Jane
                      date(birthdate): '1989-07-20T00:00:00Z'
                      interests:
                        - bikes
                        - cinema
                      reward_programs:
                        $add:
                          - premium_customer
                    events:
                      - name: added_to_cart
                        attributes:
                          $label: pumpkin
                          quantity: 5
                          unit_price: 3.99
                          $tags:
                            - fruits
                            - organic
                            - on_sale
  /profiles/mass-update:
    post:
      operationId: profile_mass_update
      tags:
        - Profiles
      summary: Mass Update
      description: Update one or multiple profile's data and track events
      security:
        - rest_key: []
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkMassUpdateProfile'
            examples:
              complete:
                description: >
                  Add the jane.doe@demo.batch.com email address on a profile.
                  Mark them as subscribed to marketing emails to they can
                  receive them. Their locale is en_FR as they're an english
                  speaker living in France. Add some properties about who they
                  are, with one appending to an existing array. Finally, track
                  an "add_to_cart" event with attributes and tags. Rework the
                  event for iOS and don't track it on web.
                value:
                  - identifiers:
                      custom_id: jane.doe@demobatch.com
                    attributes:
                      $email_address: jane.doe@demobatch.com
                      $email_marketing: subscribed
                      $phone_number: '+33182837140'
                      $sms_marketing: unsubscribed
                      $language: en
                      $region: FR
                      $timezone: Europe/Paris
                      firstname: Jane
                      date(birthdate): '1989-07-20T00:00:00Z'
                      interests:
                        - bikes
                        - cinema
                      reward_programs:
                        $add:
                          - premium_customer
                    events:
                      - name: added_to_cart
                        attributes:
                          $label: pumpkin
                          quantity: 5
                          unit_price: 3.99
                          $tags:
                            - fruits
                            - organic
                            - on_sale
      responses:
        '202':
          $ref: '#/components/responses/202'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/create:
    post:
      operationId: audience_create
      summary: Create
      description: Create an audience.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - type
              properties:
                name:
                  type: string
                  description: >-
                    The audience name value must be a string that only contains
                    letters (a-z, A-Z), numbers (0-9) or the following
                    characters : _, -. Audience names can be up to 255
                    characters long. They are case sensitive.
                  maxLength: 255
                type:
                  type: string
                  enum:
                    - custom_ids
                    - emails
                    - install_ids
                display_name:
                  type: string
            examples:
              onlyExample:
                value:
                  name: AUDIENCE_NAME
                  display_name: The audience description
                  type: custom_ids
      responses:
        '202':
          $ref: '#/components/responses/asyncResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/update:
    post:
      operationId: audience_update
      summary: Update
      description: Add or delete users from an audience.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - ids
              properties:
                name:
                  type: string
                  description: >-
                    The name of the existing audience you want this operation to
                    be applied to.
                ids:
                  type: array
                  maxItems: 10000
                  description: >
                    An array of objects describing actions to be applied to the
                    audience. <br/>If multiple actions are given for the same
                    ID, only the last one will be taken into account.
                  items:
                    type: object
                    required:
                      - action
                      - id
                    properties:
                      action:
                        type: string
                        enum:
                          - add
                          - remove
                        description: The action to be applied to the audience.
                      id:
                        type: string
                        description: >-
                          The ID that will be added to or deleted from the
                          audience.
                      attributes:
                        type: object
                        description: >
                          Only accepted for `add` action. <br/>An object
                          containing attributes to be attached to the id. They
                          can then be used in [message
                          personalization](https://doc.batch.com/guides/message-personalization/advanced/#custom-audience-data).
                          <br/>Supports up to 15 elements. See the Custom Data
                          API documentation for more info on attribute names and
                          values.
            examples:
              onlyExample:
                value:
                  name: AUDIENCE_NAME
                  ids:
                    - action: add
                      id: CUSTOM-ID-1
                      attributes:
                        att1: 3
                        att2: string
                        date(att15): '2023-08-12T22:30:05Z'
                        url(att20): https://example.com/image.jpg
                    - action: remove
                      id: CUSTOM-ID-2
      responses:
        '202':
          $ref: '#/components/responses/asyncResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/replace:
    post:
      operationId: audience_replace
      summary: Replace
      description: >-
        Replace all audience users. It removes all previously added users and
        adds the given ones.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - ids
              properties:
                name:
                  type: string
                  description: >-
                    The name of the existing audience you want this operation to
                    be applied to.
                ids:
                  type: array
                  maxItems: 10000
                  description: >-
                    An array of objects describing ids to be added to the
                    audience.
                  items:
                    type: object
                    required:
                      - id
                    properties:
                      id:
                        type: string
                        description: The ID that will be added to the audience.
                      attributes:
                        type: object
                        description: >
                          Only accepted for `add` action. <br/>An object
                          containing attributes to be attached to the id. They
                          can then be used in [message
                          personalization](https://doc.batch.com/guides/message-personalization/advanced/#custom-audience-data).
                          <br/>Supports up to 15 elements. See the Custom Data
                          API documentation for more info on attribute names and
                          values.
            examples:
              onlyExample:
                value:
                  name: AUDIENCE_NAME
                  ids:
                    - id: CUSTOM-ID-1
                      attributes:
                        att1: 3
                        att2: string
                        date(att15): '2023-08-12T22:30:05Z'
                        url(att20): https://example.com/image.jpg
                    - id: CUSTOM-ID-2
                      attributes:
                        att1: 2
                        att2: string
                        date(att15): '2023-08-12T22:30:05Z'
                        url(att20): https://example.com/image.jpg
      responses:
        '202':
          $ref: '#/components/responses/asyncResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/remove:
    post:
      operationId: audience_remove
      summary: Remove
      description: Delete an audience.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: >-
                    The name of the existing audience you want this operation to
                    be applied to.
            examples:
              onlyExample:
                value:
                  name: AUDIENCE_NAME
      responses:
        '202':
          $ref: '#/components/responses/asyncResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/list:
    get:
      operationId: audience_list
      summary: List
      description: List audiences.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: from
          in: query
          description: >-
            A cursor for pagination across multiple pages of results. Don’t
            include this parameter on the first call. Use the `next_from` value
            returned in a previous response to request subsequent results.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: A limit on the number of objects to be returned.
          required: false
          schema:
            type: integer
            default: 10
            maximum: 100
          example: 20
      responses:
        '200':
          description: >-
            If the GET to the API endpoint is successful you will receive an
            HTTP 200 confirmation and information about your audiences.
          content:
            application/json:
              schema:
                type: object
                properties:
                  audiences:
                    description: An array of objects describing each audience.
                    type: array
                    items:
                      type: object
                      $ref: '#/components/schemas/oneAudience'
                  count:
                    description: The total number of objects.
                    type: integer
                    example: 4012
                  has_more:
                    description: >-
                      Whether or not there are more elements available after
                      this set. If `false`, this set comprises the end of the
                      list.
                    type: boolean
                  next_from:
                    description: >-
                      A cursor for use in pagination. If has_more is `true`, you
                      can pass the value of `next_from` to a subsequent call to
                      fetch the next page of results.
                    type: string
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /audiences/view:
    get:
      operationId: audience_view
      summary: View
      description: Get information about an audience.
      tags:
        - Audiences
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: name
          in: query
          description: The name of the existing audience you want to view.
          required: true
          schema:
            type: string
        - name: indexing_token
          in: query
          description: >-
            The indexing token returned by the create, replace, update or remove
            routes.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: >-
            If the GET to the API endpoint is successful you will receive an
            HTTP 200 confirmation and information about your audience.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/oneAudience'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /campaigns/create:
    post:
      operationId: campaigns_create
      summary: Create
      description: Create a new campaign
      tags:
        - Campaigns
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/campaign'
            examples:
              email now:
                value:
                  name: The campaign name
                  state: RUNNING
                  send_rate: 100000
                  when:
                    local_time: false
                    start_time: now
                  targeting:
                    languages:
                      - fr
                    regions:
                      - FR
                    query:
                      firstname:
                        $eq: Jane
                  messages:
                    - channel_type: email
                      subject: The campaign subject
                      sender_identity_id: '4012'
                      reply_to:
                        email_address: jane.doe@demobatch.com
                      html: The campaign HTML content
              email scheduled:
                value:
                  name: The campaign name
                  state: RUNNING
                  send_rate: 100000
                  when:
                    local_time: true
                    start_time: '2023-10-24T10:22:00Z'
                  targeting:
                    languages:
                      - fr
                    regions:
                      - FR
                    query:
                      firstname:
                        $eq: Jane
                  messages:
                    - channel_type: email
                      subject: The campaign subject
                      sender_identity_id: '4012'
                      reply_to:
                        email_address: jane.doe@demobatch.com
                      html: The campaign HTML content
              push multi-platforms:
                value:
                  name: The campaign name
                  state: RUNNING
                  send_rate: 100000
                  when:
                    local_time: false
                    start_time: now
                  targeting:
                    languages:
                      - fr
                    regions:
                      - FR
                    query:
                      firstname:
                        $eq: Jane
                  messages:
                    - channel_type: push
                      platform_type:
                        - ios
                        - android
                        - web
                      title: The campaign title
                      body: The campaign body
                      media:
                        picture: https://example.com/picture.png
                      priority: normal
                      push_type: alert
                      time_to_live: 3600
                      filter_push_tokens: collected
                      ios:
                        deeplink: https://example.com/ios
                        custom_payload: '{"tag": "wake up push","landing_screen": "greeting"}'
                      android:
                        deeplink: https://example.com/android
                        custom_payload: '{"tag": "wake up push","landing_screen": "greeting"}'
                        media:
                          icon: https://example.com/android/icon.png
                        collapse_key:
                          enabled: true
                          key: default
                      web:
                        deeplink: https://example.com/web
                        media:
                          icon: https://example.com/web/icon.png
              push multi-languages:
                value:
                  name: The multi-languages push campaign name
                  state: RUNNING
                  send_rate: 100000
                  when:
                    start_time: now
                  messages:
                    - channel_type: push
                      platform_type:
                        - android
                        - ios
                        - web
                      title: Default language title
                      body: Default language body
                      media:
                        picture: https://example.com/default-language-picture.png
                      ios:
                        deeplink: https://example.com/ios/default-language
                      android:
                        deeplink: https://example.com/android/default-language
                        media:
                          icon: https://example.com/default-language-icon.png
                      languages:
                        - language: fr
                          title: fr title
                          body: fr body
                          media:
                            picture: https://example.com/fr-picture.png
                          ios:
                            deeplink: https://example.com/ios/fr
                          android:
                            deeplink: https://example.com/android/fr
                            media:
                              icon: https://example.com/fr-icon.png
                        - language: it
                          title: it title
                          body: it body
                          media:
                            picture: https://example.com/it-picture.png
                          ios:
                            deeplink: https://example.com/ios/it
                          android:
                            deeplink: https://example.com/android/it
                            media:
                              icon: https://example.com/it-icon.png
      responses:
        '201':
          $ref: '#/components/responses/201'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /campaigns/update:
    post:
      operationId: campaigns_update
      summary: Update
      description: Update an existing campaign
      tags:
        - Campaigns
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/campaign_update'
            example:
              id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
              campaign:
                name: The campaign name
                state: RUNNING
                send_rate: 100000
                when:
                  local_time: false
                  start_time: '2024-01-24T10:22:00Z'
                targeting:
                  languages:
                    - fr
                  regions:
                    - FR
                  query:
                    firstname:
                      $eq: Jane
                messages:
                  - channel_type: email
                    subject: The campaign subject
                    sender_identity_id: '4012'
                    reply_to:
                      email_address: jane.doe@demobatch.com
                    html: The campaign HTML content
      responses:
        '200':
          $ref: '#/components/responses/200'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /campaigns/delete:
    post:
      operationId: campaigns_delete
      summary: Delete
      description: Deletes an existing campaign
      tags:
        - Campaigns
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: The campaign id of the campaign to delete
            example:
              id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1f
      responses:
        '200':
          $ref: '#/components/responses/204'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /catalogs/create:
    post:
      operationId: catalog_create
      summary: Create
      description: Creates a new catalog.
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - fields
              properties:
                name:
                  type: string
                  example: products
                  description: Unique identifier of the catalog.
                fields:
                  type: array
                  description: List of fields defining the catalog schema.
                  minItems: 1
                  maxItems: 25
                  items:
                    $ref: '#/components/schemas/field'
      responses:
        '201':
          $ref: '#/components/responses/responses-201'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /catalogs/update:
    post:
      operationId: catalog_update
      summary: Update
      description: Updates an existing catalog.
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - fields
              properties:
                name:
                  type: string
                  example: products
                  description: Identifier of the catalog to update.
                fields:
                  description: List of fields to add or remove from the catalog.
                  type: array
                  minItems: 1
                  items:
                    type: object
                    required:
                      - action
                      - name
                    properties:
                      action:
                        $ref: '#/components/schemas/field_action'
                      name:
                        type: string
                        description: The name of the field to add or remove.
                        pattern: '[a-z0-9_]+$'
                        minLength: 1
                        maxLength: 250
                        example: price
                      type:
                        $ref: '#/components/schemas/field_type'
                        example: string
      responses:
        '202':
          $ref: '#/components/responses/responses-202'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /catalogs/remove:
    post:
      operationId: catalog_remove
      summary: Remove
      description: Remove a catalog.
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  example: products
                  description: Identifier of the catalog to remove.
      responses:
        '202':
          $ref: '#/components/responses/responses-202'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /catalogs/view:
    get:
      operationId: catalog_view
      summary: View
      description: Get information about an existing catalog.
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: name
          in: query
          required: true
          schema:
            type: string
          description: Catalog identifier to retrieve.
        - name: indexing_token
          in: query
          required: false
          schema:
            type: string
          description: Optional token used for indexing state tracking.
      responses:
        '200':
          description: Successfully retrieved the catalog metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/catalog'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /catalogs/list:
    get:
      operationId: catalog_list
      summary: List
      description: List catalogs
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: from
          in: query
          description: >-
            A cursor for pagination across multiple pages of results. Don’t
            include this parameter on the first call. Use the `next_from` value
            returned in a previous response to request subsequent results.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: To change the page size of results.
          required: false
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
          example: 20
      responses:
        '200':
          description: Successfully listed all catalogs.
          content:
            application/json:
              schema:
                type: object
                required:
                  - catalogs
                  - count
                  - has_more
                  - next_from
                properties:
                  catalogs:
                    type: array
                    description: Array of catalog objects.
                    items:
                      $ref: '#/components/schemas/catalog'
                  count:
                    type: integer
                    example: 5
                    description: Total number of catalogs.
                  has_more:
                    type: boolean
                    example: false
                    description: Indicates whether more catalogs are available.
                  next_from:
                    type: string
                    description: Cursor for pagination if more results are available.
  /catalogs/items/edit:
    post:
      operationId: catalog_items_edit
      summary: Items Edit
      description: Adds, updates or removes catalog items by ID.
      tags:
        - Catalogs
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - items
              properties:
                name:
                  type: string
                  description: Name of the catalog.
                  example: products
                items:
                  type: array
                  minItems: 1
                  maxItems: 200
                  description: List of catalog items to add or remove.
                  items:
                    type: object
                    required:
                      - action
                      - id
                    properties:
                      id:
                        type: string
                        description: Unique identifier of the catalog item.
                        example: CATALOG_ITEM_ID
                      action:
                        type: string
                        enum:
                          - add
                          - remove
                        description: Action to perform on the catalog item.
                        example: add
                      attributes:
                        type: object
                        $ref: '#/components/schemas/attributes'
      responses:
        '202':
          $ref: '#/components/responses/responses-asyncResponse'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /exports/list:
    get:
      operationId: export_list
      summary: List
      description: List export requests created.
      tags:
        - Exports
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: from
          in: query
          description: >-
            A cursor for pagination across multiple pages of results. Don’t
            include this parameter on the first call. Use the `next_from` value
            returned in a previous response to request subsequent results.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: To change the page size of results.
          required: false
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
          example: 20
      responses:
        '200':
          description: >-
            If the GET to the API endpoint is successful you will receive an
            HTTP 200 confirmation and information about your export requests.
            This information is an array of all requests we currently know of
            for your project. The output contains requests created in the last 4
            months.
          content:
            application/json:
              schema:
                type: object
                properties:
                  exports:
                    description: An array of objects describing each export requests.
                    type: array
                    items:
                      type: object
                      $ref: '#/components/schemas/request'
                  count:
                    description: The number of objects.
                    type: integer
                    example: 25
                    minimum: 0
                    maximum: 100
                  has_more:
                    description: >-
                      Whether or not there are more elements available after
                      this set. If `false`, this set comprises the end of the
                      list.
                    type: boolean
                  next_from:
                    description: >-
                      A cursor for use in pagination. If has_more is `true`, you
                      can pass the value of `next_from` to a subsequent call to
                      fetch the next page of results.
                    type: string
                    example: MjAyNC0wMS0wMVQwMDowMDowMFo=
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /exports/view:
    get:
      operationId: export_view
      summary: View
      description: Get information about an export request.
      tags:
        - Exports
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: id
          in: query
          description: Export request id received when creating an export request.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            If the GET to the API endpoint is successful you will receive an
            HTTP 200 confirmation and information about your export request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/request'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /exports/download:
    get:
      operationId: export_download
      summary: Download
      description: >
        Download the extraction file of an export request.

        </br></br>Status of the export must be `SUCCESS` to call this API. See
        <a href="/operations/export_view">view export API</a> to get the current
        status of your export.

        </br></br>The link to the JSON file that you can found under the
        `Location` section of the response header will expire after 20 minutes.
        You will need to call this API again to generate a new file.
      tags:
        - Exports
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: id
          in: query
          description: ID of the file to be downloaded.
          required: true
          schema:
            type: string
          example: file_063bc4w4x8e363yem6wfnxc5c13c0n46
      responses:
        '307':
          $ref: '#/components/responses/307'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /orchestrations/list:
    get:
      operationId: orchestrations_list
      summary: List
      description: List orchestrations.
      tags:
        - Orchestrations
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: from
          in: query
          description: >-
            A cursor for pagination across multiple pages of results. Don’t
            include this parameter on the first call. Use the `next_from` value
            returned in a previous response to request subsequent results.
          schema:
            type: string
          example: eW9kYSBVRAMjAyNS0wNS0xNFQxNDo1cGRhdGUgc2FtcGxlIEFuZHJvaWMzo1NFo=
        - name: limit
          in: query
          description: A limit on the number of objects to be returned.
          schema:
            type: integer
            maximum: 100
            default: 10
          example: 10
        - name: status
          in: query
          description: Filter orchestrations by status.
          schema:
            type: array
            items:
              type: string
              enum:
                - draft
                - running
                - completed
                - stopped
            default:
              - running
              - completed
          style: form
          explode: true
          example:
            - running
            - completed
        - name: type
          in: query
          description: >-
            Filter orchestrations by type. If not provided, all types are
            returned.
          schema:
            type: array
            items:
              type: string
              enum:
                - campaign
                - recurring
                - trigger
            default:
              - campaign
              - recurring
              - trigger
          style: form
          explode: true
          required: false
          example:
            - campaign
      responses:
        '200':
          description: Successful response with a list of orchestrations.
          content:
            application/json:
              schema:
                type: object
                properties:
                  orchestrations:
                    type: array
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/Campaign'
                        - $ref: '#/components/schemas/Recurring'
                        - $ref: '#/components/schemas/TriggerAutomation'
                  count:
                    description: The total number of objects.
                    type: integer
                  has_more:
                    description: >-
                      Whether or not there are more elements available after
                      this set. If `false`, this set comprises the end of the
                      list.
                    type: boolean
                  next_from:
                    description: >-
                      A cursor for use in pagination. If has_more is `true`, you
                      can pass the value of `next_from` to a subsequent call to
                      fetch the next page of results.
                    type: string
              examples:
                Campaign:
                  value:
                    orchestrations:
                      - id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
                        type: campaign
                        channels:
                          - push
                        platforms:
                          - ios
                          - android
                        source: dashboard
                        created_date: '2017-03-02T09:43:17'
                        name: Test Campaign 1
                        labels:
                          - LABEL1
                          - LABEL2
                        status: running
                        start_time: '2017-07-06T14:09:18'
                    count: 132
                    has_more: true
                    next_from: >-
                      eW9kYSBVRAMjAyNS0wNS0xNFQxNDo1cGRhdGUgc2FtcGxlIEFuZHJvaWMzo1NFo=
                Recurring:
                  value:
                    orchestrations:
                      - id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
                        type: recurring
                        channels:
                          - push
                        platforms:
                          - ios
                          - android
                        source: dashboard
                        created_date: '2017-03-02T09:43:17'
                        name: Test Campaign 2
                        labels:
                          - Onboarding
                        status: running
                        start_time: '2017-03-03T13:10:19'
                        recurrence:
                          end_time: '2017-07-22T23:59:59'
                          repeat_unit: WEEKLY
                          repeat_frequency: 2
                        capping: 2
                    count: 132
                    has_more: true
                    next_from: >-
                      eW9kYSBVRAMjAyNS0wNS0xNFQxNDo1cGRhdGUgc2FtcGxlIEFuZHJvaWMzo1NFo=
                TriggerAutomation:
                  value:
                    orchestrations:
                      - id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
                        type: trigger
                        channels:
                          - push
                          - sms
                          - email
                        platforms:
                          - ios
                          - android
                        source: dashboard
                        created_date: '2017-03-02T09:43:17'
                        name: Test Campaign 2
                        labels:
                          - Onboarding
                        status: running
                        start_time: '2017-03-02T09:43:17'
                        end_time: '2017-03-10T09:43:17'
                        capping: '2'
                        nbr_steps: '5'
                        nbr_message_steps: '2'
                        message_steps:
                          - step_name: First Step
                            step_id: step_abc
                          - step_name: Second Step
                            step_id: step_def
                    count: 132
                    has_more: true
                    next_from: >-
                      eW9kYSBVRAMjAyNS0wNS0xNFQxNDo1cGRhdGUgc2FtcGxlIEFuZHJvaWMzo1NFo=
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /orchestrations/stats:
    get:
      operationId: orchestrations_stats
      summary: Stats
      description: Get statistics about an orchestration.
      tags:
        - Orchestrations
      parameters:
        - $ref: '#/components/parameters/HeaderProjectKey'
        - name: orchestration_id
          in: query
          description: The id of the orchestration to fetch statistics from.
          required: true
          schema:
            type: string
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        - name: from
          in: query
          description: >-
            Statistics starting date in a yyyy-MM-dd format. Cannot be earlier
            than 6 months ago.
          required: true
          schema:
            type: string
            format: date
          example: '2025-01-13'
        - name: to
          in: query
          required: true
          description: Statistics ending date in a yyyy-MM-dd format.
          schema:
            type: string
            format: date
          example: '2025-02-12'
      responses:
        '200':
          description: Successful response with statistics about an orchestration.
          content:
            application/json:
              schema:
                type: object
                oneOf:
                  - $ref: '#/components/schemas/CampaignAndRecurringStats'
                  - $ref: '#/components/schemas/TriggerAutomationStats'
              examples:
                Campaign & Recurring:
                  value:
                    id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
                    details:
                      - date: '2025-03-18'
                        sent: 972
                        delivered: 847
                        unique_open: 214
                        total_open: 259
                        unique_machine_open: 126
                        unique_click: 37
                        total_click: 41
                        spam: 4
                        unsubscribe: 13
                        total_bounce: 14
                        skipped: 15
                        versions:
                          - version: a
                            sent: 530
                            delivered: 465
                            unique_open: 139
                            total_open: 161
                            unique_machine_open: 37
                            unique_click: 14
                            total_click: 16
                            spam: 3
                            unsubscribe: 10
                            total_bounce: 4
                            skipped: 10
                          - version: b
                            sent: 442
                            delivered: 382
                            unique_open: 75
                            total_open: 98
                            unique_machine_open: 89
                            unique_click: 23
                            total_click: 25
                            spam: 1
                            unsubscribe: 3
                            total_bounce: 10
                            skipped: 5
                TriggerAutomation:
                  value:
                    id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
                    details:
                      - date: '2025-03-18'
                        sent: 972
                        delivered: 847
                        unique_open: 214
                        total_open: 259
                        unique_machine_open: 126
                        unique_click: 37
                        total_click: 41
                        spam: 4
                        unsubscribe: 13
                        total_bounce: 14
                        skipped: 15
                        message_steps:
                          - step_id: step_0664hyh918hr1gnzka9py5t62nrc0e1q
                            sent: 530
                            delivered: 465
                            unique_open: 139
                            total_open: 161
                            unique_machine_open: 37
                            unique_click: 14
                            total_click: 16
                            spam: 3
                            unsubscribe: 10
                            total_bounce: 4
                            skipped: 10
                          - step_id: step_aae13559e0493c0b350c547533f5b28f
                            sent: 442
                            delivered: 382
                            unique_open: 75
                            total_open: 98
                            unique_machine_open: 89
                            unique_click: 23
                            total_click: 25
                            spam: 1
                            unsubscribe: 3
                            total_bounce: 10
                            skipped: 5
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
security:
  - rest_key: []
components:
  securitySchemes:
    legacy_rest_key:
      type: apiKey
      in: header
      name: X-Authorization
      description: >
        ## API Key Authentication


        Authentication is required in order to interact with Batch's APIs.


        Batch implements authentication using API Keys, that we call the "REST
        API Key".

        You can find it on your dashboard.


        Please make sure that you keep this API Key secret. You should never use
        it in client apps to call APIs from there as it would

        easily be extractable.


        ### How to authenticate


        In order to authenticate your requests, add your API Key in the
        `X-Authorization` header.
    rest_key:
      type: http
      scheme: bearer
      description: >
        ## API Key Authentication


        Authentication is required in order to interact with Batch's APIs.


        Batch implements authentication using API Keys, that we call the "REST
        API Key".

        You can find it on your dashboard.


        Please make sure that you keep this key secret. You should never use it
        in client apps to call APIs from there as it would

        easily be extractable.


        ### How to authenticate


        In order to authenticate your requests, add your REST API Key in the
        `Authorization` header and prefix it by `Bearer`. Example:
        `Authorization: Bearer bcd38d9rfb38ra28`.
  parameters:
    HeaderProjectKey:
      in: header
      name: X-Batch-Project
      description: The unique project key, identifying a project on the Batch platform
      schema:
        type: string
      example: project_0664hxvwffvbpn278gxdyhsadddqgna6
      required: true
  schemas:
    ExportAttributeRequest:
      type: object
      title: Profile Attributes export
      required:
        - export_type
      properties:
        export_type:
          type: string
          description: Type of the export events request.
          example: ATTRIBUTES
          enum:
            - ATTRIBUTES
        attributes:
          type: array
          minItems: 1
          items:
            type: string
          description: >
            List of custom or native attributes to be included in the export
            file(s). Any value that does not start with a `$` will be
            interpreted as a custom attribute. A list of native attributes
            available is provided below:


            - `$creation_date`

            - `$email_address`

            - `$email_marketing`

            - `$language`

            - `$last_activity`

            - `$last_email_marketing_click`

            - `$last_email_marketing_open`

            - `$last_email_transactional_click`

            - `$last_email_transactional_open`

            - `$last_visit_date`

            - `$phone_number`

            - `$region`

            - `$sms_marketing`

            - `$timezone`

            - `$push_subscriptions`

            - `$install_date`
          example:
            - $email_address
            - $email_marketing
            - $sms_marketing
            - firstname
            - is_premium
        identifiers:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - custom_id
              - installation_ids
          description: List of profile identifiers to be included in the export file(s).
          example:
            - custom_id
            - installation_ids
        filter:
          type: object
          description: >-
            Optional filter to refine the export. A rate limit applies when
            using this parameter.
          properties:
            segment:
              type: string
              description: Code of the segment you want to filter this export with.
          example:
            segment: MY-SEGMENT-CODE
    ExportEventRequest:
      type: object
      title: Profile Events export
      required:
        - export_type
        - from
        - to
        - events
      properties:
        export_type:
          type: string
          description: Type of the export events request.
          example: EVENTS
          enum:
            - EVENTS
        from:
          type: string
          description: >-
            UTC date in a RFC 3339. Must be before `to` parameter and not older
            than the lookback period.
          examples:
            - '2023-08-12T22:30:05Z'
        to:
          type: string
          description: UTC date in a RFC 3339 format or `now`.
          examples:
            - now
            - '2023-08-12T22:30:05Z'
        identifiers:
          type: array
          items:
            type: string
            enum:
              - custom_id
          description: List of profile identifiers to be included in the export file(s).
        events:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - email_bounced
              - email_click
              - email_delivered
              - email_open
              - email_sent
              - email_spam_complaint
              - email_unsubscribed
              - sms_sent
              - sms_bounced
              - sms_delivered
              - sms_unsubscribed
              - push_sent
              - push_bounced
              - push_open
          description: List of events to be included in the export file(s).
          example:
            - email_sent
            - sms_sent
            - push_sent
        orchestration_ids:
          type: array
          minItems: 1
          items:
            type: string
          description: >-
            List of orchestrations IDs to be exported. If not provided, all
            orchestrations will be exported.
          example:
            - orchestration_068evgdtkgtq2f8z9p1bvmqv1jke9srt
    ExportReachabilityRequest:
      type: object
      title: Profile Reachability export
      required:
        - export_type
        - from
        - to
        - channels
      properties:
        export_type:
          type: string
          description: Type of the export reachability request.
          enum:
            - REACHABILITY
        from:
          type: string
          description: >-
            UTC date in a RFC 3339. Must be before `to` parameter and not older
            than the lookback period.
          examples:
            - '2023-08-12T22:30:05Z'
        to:
          type: string
          description: UTC date in a RFC 3339 format or `now`.
          examples:
            - now
            - '2023-08-12T22:30:05Z'
        identifiers:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - custom_id
              - installation_id
          description: List of profile identifiers to be included in the export file(s).
          example:
            - custom_id
            - installation_id
        channels:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - email
              - push
              - sms
    Error:
      type: object
      required:
        - error_message
        - error_code
      properties:
        error_message:
          description: A human readable error message
          type: string
        error_code:
          description: Error code
          type: string
    ProfileIdentifiers:
      type: object
      required:
        - custom_id
      properties:
        custom_id:
          description: Custom user ID of the profile to perform the operation on
          type: string
          maxLength: 512
      example:
        custom_id: e0b4bf0d-5d70-4c0f-a963-6e87c6fb26f7
    EditProfileAttributes:
      description: >
        Attributes to write on the profile. Keys are the attributes names. You
        can set up to 50 attributes on a profile per operation: requests
        exceeding this limit will be ignored. Some keys are documented as
        they're reserved, but extra data is supported: See [the attributes
        documentation](https://doc.batch.com/api/profile/update/#the-attributes-object).
        This object cannot weigh more than 25kB or the entire Profile API
        request will be rejected.
      type: object
      properties:
        $email_address:
          description: >-
            Email address to write on the profile. Null to erase, omit to leave
            the email unmodified. Addresses must be valid, not longer than 256
            characters.
          type:
            - string
            - 'null'
          maxLength: 256
          pattern: ^[^\r\n\t@]+@[A-z0-9\-\.]+\.[A-z0-9]+$
        $email_marketing:
          description: >-
            Set whether the profile should receive marketing emails or not. Set
            to null to reset, omit to leave unmodified.
          type:
            - string
            - 'null'
          enum:
            - subscribed
            - unsubscribed
        $phone_number:
          description: >-
            Phone number to write on the profile. Null to erase, omit to leave
            the phone number unmodified. The number must conform to the [E.164
            international standard](https://en.wikipedia.org/wiki/E.164).
          type:
            - string
            - 'null'
        $sms_marketing:
          description: >-
            Set whether the profile should receive marketing SMS or not. Set to
            null to reset, omit to leave unmodified.
          type:
            - string
            - 'null'
          enum:
            - subscribed
            - unsubscribed
        $timezone:
          description: >
            Timezone to set on the profile. Set to null to erase, omit to leave
            unmodified. Value must be an IANA TZ Identifier. Example:
            `Europe/Paris`. You can find an non exhaustive list of available TZ
            identifiers
            [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
          type:
            - string
            - 'null'
        $language:
          description: >
            Custom language to set on the profile. Set to null to erase, omit to
            leave unmodified. Language codes must conform to a subset of BCP 47
            language tags. See [our
            documentation](https://doc.batch.com/api/campaigns/advanced#language-and-country-codes)
            for a list of supported languages.
          type:
            - string
            - 'null'
        $region:
          description: >
            Custom country code to set on the profile. Set to null to erase,
            omit to leave unmodified. Country codes must conform to the ISO
            3166-1 alpha-2 standard. See [our
            documentation](https://doc.batch.com/api/campaigns/advanced#language-and-country-codes)
            for a list of supported languages.
          type:
            - string
            - 'null'
      additionalProperties:
        oneOf:
          - type: string
          - type: number
          - type: object
          - type: boolean
          - type: array
            items:
              type: string
    TrackEventAttributes:
      description: >-
        Event attributes. Keys are the attribute names. Some keys are documented
        as they're reserved, but extra data is supported. See [the event
        attributes
        documentation](https://doc.batch.com/api/profile/update/#the-events-object)
        for more info.
      type: object
      properties:
        $label:
          type: string
          description: >-
            Event label. Must be a string, will automatically be bridged as
            label for application event compatiblity.
          maxLength: 200
        $tags:
          type: array
          items:
            type: string
          description: >-
            Event tags. Must be an array of string, will automatically be
            bridged as tags for application event compatiblity. Tags must not be
            longer than 64 characters.
          maxItems: 10
      additionalProperties:
        oneOf:
          - type: string
          - type: number
          - type: object
          - type: boolean
          - type: array
            items: {}
    TrackProfileEvent:
      type: object
      required:
        - name
      properties:
        name:
          description: >-
            Event name. Cannot be empty, must not be longer than 30 chars and
            not contain any special character ([a-z0-9_]). Case insensitive.
          example: added_to_cart
          type: string
          pattern: '[a-z0-9_]'
          maxLength: 30
        time:
          description: >
            UTC date in a RFC 3339 format. The time date and time an event
            occurred. You can track events that happened in the last 24 hours,
            and no events in the future. If this parameter is not included in
            your request, Batch will use the time the event arrives at the
            server.
          type: string
          example: '2012-08-12T22:30:05Z'
        attributes:
          $ref: '#/components/schemas/TrackEventAttributes'
    EditProfile:
      type: object
      required:
        - identifiers
      properties:
        identifiers:
          $ref: '#/components/schemas/ProfileIdentifiers'
        attributes:
          $ref: '#/components/schemas/EditProfileAttributes'
        events:
          description: >-
            Events to track on the profile. This array cannot weigh more than
            150kB or have more than 20 elements and individual events cannot
            weigh more than 25kB. If one of these limits are exceeded, the
            complete Profile API call will be rejected.
          type: array
          maxItems: 20
          items:
            $ref: '#/components/schemas/TrackProfileEvent'
    BulkEditProfile:
      description: >-
        Edit multiple profiles at once. You can specify at most 200 operations
        or the API call will be rejected.
      type: array
      items:
        $ref: '#/components/schemas/EditProfile'
    BulkMassUpdateProfile:
      description: >-
        Edit multiple profiles at once. You can specify at most 10 000
        operations or the API call will be rejected.
      type: array
      items:
        $ref: '#/components/schemas/EditProfile'
    PartialSuccessResponseErrors:
      description: A validation error.
      type: object
      required:
        - bulk_index
        - category
        - reason
      properties:
        category:
          description: >-
            What part of the operation the error applies to. For example,
            `attribute` means that the error came from one of the profile
            attributes. Depending on the error category, other keys might be
            available to help you pinpoint where the error occurred.
          type: string
          enum:
            - attribute
            - event
            - event_name
            - event_attribute
            - identifier
            - attribute_limit
        bulk_index:
          description: >-
            Index of what bulk operation (requests' top level array) the error
            occurred in.
          type: number
        reason:
          description: Human readable reason explaining what caused the error.
          type: string
        attribute:
          description: >-
            Only applicable when `category` is `attribute`, `attribute_limit` or
            `event_attribute`. Name of the profile attribute that caused the
            error.
          type: string
        event_index:
          description: >-
            Only applicable when `category` is `event`, `event_name` or
            `event_attribute`. Index of the event that caused the error.
          type: number
    SuccessResponse:
      description: >-
        Success response. The API call was entirely valid and will be processed
        as requested.
      type: object
      required:
        - code
      properties:
        code:
          description: Success status code
          type: string
          enum:
            - SUCCESS
            - SUCCESS_WITH_PARTIAL_ERRORS
        errors:
          description: >-
            Array of errors that occurred while validating the request. Only
            present if code is `SUCCESS_WITH_PARTIAL_ERRORS`.
          type: array
          items:
            $ref: '#/components/schemas/PartialSuccessResponseErrors'
    oneAudience:
      type: object
      properties:
        name:
          type: string
        display_name:
          type: string
        type:
          type: string
          enum:
            - CUSTOM_ID
        nb_ids:
          type: integer
        indexing_state:
          type: string
          enum:
            - APPLIED
            - IN_PROGRESS
            - REPLACED
        created:
          type: string
          description: UTC Date in a RFC 3339 format.
          examples:
            - '2023-08-12T22:30:05Z'
        updated:
          type: string
          description: UTC Date in a RFC 3339 format.
          examples:
            - '2023-08-12T22:30:05Z'
    when:
      type: object
      required:
        - start_time
      properties:
        local_time:
          type: boolean
          description: >-
            If true, Batch servers will send messages according to each time
            zone. The campaign will take 24 hours to complete
        start_time:
          type: string
          description: >-
            Campaign start date in UTC in a RFC 3339 date-time format (for
            example 2023-10-24T10:22:00Z) or ***now*** to start the campaign as
            soon as the call is made
    targeting:
      type: object
      properties:
        languages:
          type: array
          items:
            type: string
          description: >-
            An array containing all device languages to be targeted. All
            language codes in this array must be contained in the messages
            object. [See
            here](https://doc.batch.com/api/campaigns/advanced#_language-and-country-codes)
            for matching rules and valid language codes.
            E.g.{"languages":["it","fr"]}
        regions:
          type: array
          items:
            type: string
          description: >-
            An array containing all the geographical regions codes to be
            targeted. [See
            here](https://doc.batch.com/api/campaigns/advanced#_language-and-country-codes)
            for all valid region codes. E.g.{"regions":["FR","US"]}
        query:
          type: object
          description: >-
            A mongo inspired query object containing filters & operators, based
            on native attributes (app version, OS version, etc) and custom users
            data (attributes, tags & events defined by you in the SDK)
    languageEmail:
      type: object
      required:
        - language
        - subject
        - sender_identity_id
        - html
      properties:
        language:
          type: string
          example: en
        subject:
          type: string
        sender_identity_id:
          type: string
        reply_to:
          type: object
          required:
            - email_address
          properties:
            email_address:
              type: string
        html:
          type: string
          description: Your email content as html
    email:
      title: email
      description: A representation of an email message
      type: object
      required:
        - channel_type
        - subject
        - sender_identity_id
        - html
      properties:
        channel_type:
          type: string
          enum:
            - email
        subject:
          type: string
        sender_identity_id:
          type: string
        reply_to:
          type: object
          required:
            - email_address
          properties:
            email_address:
              type: string
        html:
          type: string
          description: Your email content as html
        languages:
          type: array
          items:
            $ref: '#/components/schemas/languageEmail'
          description: >-
            Array of translations. Default language content is located at the
            level above.
    languagePush:
      type: object
      required:
        - language
        - body
      properties:
        language:
          type: string
          example: en
        title:
          type: string
          description: Title of the notification. Can use personalization
        body:
          type: string
          description: Body of the notification. Can use personalization
        media:
          type: object
          description: Rich notification content
          properties:
            picture:
              type: string
              description: >-
                URL to an image that will be displayed as the main notification
                image. The file must be a RGB PNG or JPG image with a minimum
                height of 300px and width of 200px. Your server must support the
                HTTP OPTION verb. Can use personalization
        ios:
          type: object
          description: iOS specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
        android:
          type: object
          description: Android specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
            media:
              type: object
              description: Rich notification content
              properties:
                icon:
                  type: string
                  description: >-
                    URL to an image that will be displayed as the icon of a
                    notification. The file must be a square PNG or JPG image
                    with a minimum size of 196px and your server must support
                    the HTTP OPTION verb. Can use personalization
        web:
          type: object
          description: Web specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
            media:
              type: object
              description: Rich notification content
              properties:
                icon:
                  type: string
                  description: >-
                    URL to an image that will be displayed as the icon of a
                    notification. The file must be a square PNG or JPG image
                    with a minimum size of 196px and your server must support
                    the HTTP OPTION verb. Can use personalization
    push:
      title: push
      description: A representation of a push message
      type: object
      required:
        - channel_type
        - platform_type
        - body
      properties:
        channel_type:
          type: string
          enum:
            - push
        platform_type:
          type: array
          items:
            type: string
            enum:
              - ios
              - android
              - web
        title:
          type: string
          description: Title of the notification. Can use personalization
        body:
          type: string
          description: Body of the notification. Can use personalization
        media:
          type: object
          description: Rich notification content
          properties:
            picture:
              type: string
              description: >-
                URL to an image that will be displayed as the main notification
                image. The file must be a RGB PNG or JPG image with a minimum
                height of 300px and width of 200px. Your server must support the
                HTTP OPTION verb. Can use personalization
        priority:
          type: string
          enum:
            - normal
            - high
          default: high
          description: >-
            Defines the priority of your message on iOS (APNS) and Android
            (FCM). If you set `push_type` to `background`, this value MUST be
            `normal`
        push_type:
          type: string
          enum:
            - alert
            - background
          default: alert
          description: >-
            Defines whether notifications should show an alert or be silent to
            trigger a background action
        time_to_live:
          type: integer
          description: >-
            Time to live (TTL) represents the time a notification can be held
            for delivery in seconds before expiring. If a user was offline and
            comes back online after this duration, the notification will not be
            delivered. It does not remove notifications already delivered to
            devices. Setting a value of `0` disables the TTL, which leaves
            expiration up to the platform push service
          minimum: 0
          maximum: 2419200
          default: 0
        filter_push_tokens:
          type: string
          enum:
            - all
            - collected
            - imported
          default: collected
          description: >
            `all` - the campaign will target imported and collected push
            tokens<br> `collected` - the campaign will target only collected
            push tokens, detected by Batch SDKs<br> `imported` - the campaign
            will target only imported push tokens, not yet detected by Batch
            SDKs
        ios:
          type: object
          description: iOS specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
            custom_payload:
              type: string
              description: >-
                String representation of a JSON object. Can be used to override
                standard keys, such as `aps`. Using the `com.batch` key is
                forbidden. Can use personalization
        android:
          type: object
          description: Android specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
            custom_payload:
              type: string
              description: >-
                String representation of a JSON object. Can be used to override
                standard keys, such as `aps`. Using the `com.batch` key is
                forbidden. Can use personalization
            media:
              type: object
              description: Rich notification content
              properties:
                icon:
                  type: string
                  description: >-
                    URL to an image that will be displayed as the icon of a
                    notification. The file must be a square PNG or JPG image
                    with a minimum size of 196px and your server must support
                    the HTTP OPTION verb. Can use personalization
            collapse_key:
              type: object
              description: >-
                Defines how notifications are managed when an offline device
                goes online (enabled by default). If enabled, the device will
                only show the most recent notification. If disabled, it will
                show all the notifications received when the device was offline.
                You should disable the collapse key if all your notifications
                matter (E.g. messages, etc) . You can use up to 3 different
                collapse keys if you want users to get only one notification of
                each kind when coming online (E.g. marketing messages, alert,
                etc)
              properties:
                enabled:
                  type: boolean
                  description: Whether the collapse_key is enabled or not
                key:
                  type: string
                  description: collapse_key grouping value
        web:
          type: object
          description: Web specific attributes
          properties:
            deeplink:
              type: string
              maxLength: 1024
              description: >-
                Deeplink that the notification should point to once opened. Can
                use personalization
            media:
              type: object
              description: Rich notification content
              properties:
                icon:
                  type: string
                  description: >-
                    URL to an image that will be displayed as the icon of a
                    notification. The file must be a square PNG or JPG image
                    with a minimum size of 196px and your server must support
                    the HTTP OPTION verb. Can use personalization
        languages:
          type: array
          items:
            $ref: '#/components/schemas/languagePush'
          description: >-
            Array of translations. Default language content is located at the
            level above.
    campaign:
      type: object
      required:
        - name
        - state
        - messages
        - when
      properties:
        name:
          type: string
          description: Display name of the campaign on the dashboard
        state:
          type: string
          enum:
            - RUNNING
          description: Only RUNNING state supported for now
        send_rate:
          type: integer
          minimum: 1000
          maximum: 1000000
          description: Determines the maximum number of messages to be sent per minute.
        when:
          type: object
          $ref: '#/components/schemas/when'
          description: Campaign programation details (when/how to send)
        targeting:
          type: object
          $ref: '#/components/schemas/targeting'
          description: Who should be reached by the campaign
        messages:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/email'
              - $ref: '#/components/schemas/push'
            discriminator:
              propertyName: channel_type
              mapping:
                email: '#/components/schemas/email'
                push: '#/components/schemas/push'
          description: Messages to send, only one kind of message is allowed at a time.
    schemas-SuccessResponse:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: >-
            The campaign id associated with the campaign to use for further
            requests.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
    campaign_update:
      type: object
      required:
        - id
        - campaign
      properties:
        id:
          type: string
          description: Campaign id received from the create API
        campaign:
          type: object
          $ref: '#/components/schemas/campaign'
          description: >-
            Campaign object as describe in the create query. An update on a
            campaign will overwrite its contents. It is not possible to update a
            completed or running campaign if not recurrent
    EmptyResponse:
      type: object
    field_type:
      type: string
      description: Enumerates the possible data types allowed for catalog fields.
      enum:
        - array
        - bool
        - date
        - float
        - integer
        - string
        - url
      example: float
    field:
      description: >-
        A field defines a single attribute type that items in the catalog can
        have. Each field has a unique name and a type.
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: The name of the field as it will appear on catalog items.
          pattern: '[a-z0-9_]+$'
          minLength: 1
          maxLength: 250
          example: price
        type:
          $ref: '#/components/schemas/field_type'
          example: float
          description: The data type for this field, such as integer or string.
    field_action:
      type: string
      description: Action to perform on a catalog field during updates.
      enum:
        - add
        - remove
      example: add
    catalog:
      description: >-
        A catalog represents a structured collection of items and associated
        fields that define the schema of those items.
      type: object
      required:
        - name
        - fields
        - items
        - size
        - created
        - updated
      properties:
        name:
          type: string
          example: products
          description: >-
            Unique identifier for the catalog, used for referencing in API
            calls.
        fields:
          type: array
          description: List of fields that define the schema of items in the catalog.
          items:
            $ref: '#/components/schemas/field'
          minItems: 1
          maxItems: 25
        items:
          type: integer
          example: 42
          description: Total number of items currently stored in this catalog.
        size:
          type: integer
          example: 4882372
          description: Size of the catalog data in bytes.
        created:
          type: string
          format: date-time
          description: RFC 3339 UTC date indicating when the catalog was created.
        updated:
          type: string
          format: date-time
          description: RFC 3339 UTC date of the last update to the catalog.
        indexing_state:
          type: string
          enum:
            - IN_PROGRESS
            - APPLIED
          example: APPLIED
          description: Indicates the current indexing state of the catalog items.
    attributes:
      type: object
      description: |
        A map of attribute keys to values.
        Key rules:
          - `url(...)` → value must be a valid URL
          - `date(...)` → value must be RFC 3339 or Unix timestamp
          - `^[a-z0-9_]+$` → regular attribute names
      additionalProperties:
        oneOf:
          - type: array
            maxItems: 15
            items:
              type: string
              maxLength: 64
          - type: boolean
          - type: integer
          - type: number
            format: float
          - type: string
            maxLength: 10000
          - type: string
            format: date-time
          - type: integer
            format: int64
          - type: string
            format: uri
      example:
        product_name: Sample Product
        price: 19.99
        tags:
          - summer
          - sale
        date(launch_date): '2023-08-01T12:00:00Z'
        available: true
        url(website): https://example.com
    scope:
      type: string
      enum:
        - PROFILE_ATTRIBUTES
        - PROFILE_EVENTS
    status:
      type: string
      enum:
        - CREATED
        - PENDING
        - RUNNING
        - ERROR
        - SUCCESS
    file:
      type: object
      title: file
      properties:
        id:
          type: string
          description: Id of the extraction file available for download if any.
          example: file_wbgjapsjscryqah0bcwrg1w5kv0dcfkj
        part:
          type: integer
          description: The part number of the file
          example: 1
          minimum: 1
        size:
          type: integer
          description: Size of the file in bytes.
          example: 2048
        url:
          type: string
          description: URL to download the file.
          examples:
            - >-
              https://api.batch.com/2.4/exports/download?id=file_wbgjapsjscryqah0bcwrg1w5kv0dcfkj
    request:
      anyOf:
        - type: object
          required:
            - id
            - requested_at
            - scope
            - status
            - files
            - request
          properties:
            id:
              type: string
              description: Id of an export request.
              example: export_063bc4w4x8e363yem6wfnxc5c13c0n46
            request_date:
              type: string
              description: UTC date in a RFC 3339 format.
              example: '2023-08-12T22:30:05Z'
            completion_date:
              type: string
              description: UTC date in a RFC 3339 format.
              example: '2023-08-12T22:30:05Z'
            start_date:
              type: string
              description: UTC date in a RFC 3339 format.
              example: '2023-08-12T22:30:05Z'
            scope:
              description: The scope of the export.
              $ref: '#/components/schemas/scope'
            status:
              description: The status of the export request.
              $ref: '#/components/schemas/status'
            files:
              type: array
              description: All the extraction files available for download if any.
              items:
                $ref: '#/components/schemas/file'
            request:
              type: object
              description: The export request definition.
              oneOf:
                - $ref: '#/components/schemas/ExportAttributeRequest'
                - $ref: '#/components/schemas/ExportEventRequest'
    Campaign:
      type: object
      description: Details for a campaign orchestration.
      properties:
        id:
          type: string
          description: Unique identifier for the orchestration.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        type:
          type: string
          enum:
            - campaign
        channels:
          type: array
          items:
            type: string
            enum:
              - push
              - sms
              - email
          description: Channels used by the orchestration.
          example:
            - push
        platforms:
          type: array
          items:
            type: string
            enum:
              - ios
              - android
              - web
          description: Platforms targeted by the orchestration.
          example:
            - ios
            - android
        source:
          type: string
          description: Source of the orchestration creation.
          example: dashboard
        created_date:
          type: string
          format: date-time
          description: Date and time when the orchestration was created.
          example: '2017-03-02T09:43:17'
        name:
          type: string
          description: Name of the orchestration.
          example: Test Campaign 1
        labels:
          type: array
          items:
            type: string
          description: Labels associated with the orchestration.
          example:
            - LABEL1
            - LABEL2
        status:
          type: string
          description: Current status of the orchestration.
          enum:
            - draft
            - running
            - completed
            - stopped
          example: running
        start_time:
          type: string
          format: date-time
          description: Date and time when the orchestration started.
          example: '2017-07-06T14:09:18'
    Recurring:
      type: object
      description: Details for a recurring orchestration.
      properties:
        id:
          type: string
          description: Unique identifier for the orchestration.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        type:
          type: string
          enum:
            - recurring
        channels:
          type: array
          items:
            type: string
            enum:
              - push
              - sms
              - email
          description: Channels used by the orchestration.
          example:
            - push
        platforms:
          type: array
          items:
            type: string
            enum:
              - ios
              - android
              - web
          description: Platforms targeted by the orchestration.
          example:
            - ios
            - android
        source:
          type: string
          description: Source of the orchestration creation.
          example: dashboard
        created_date:
          type: string
          format: date-time
          description: Date and time when the orchestration was created.
          example: '2017-03-02T09:43:17'
        name:
          type: string
          description: Name of the orchestration.
          example: Test Campaign 1
        labels:
          type: array
          items:
            type: string
          description: Labels associated with the orchestration.
          example:
            - LABEL1
            - LABEL2
        status:
          type: string
          description: Current status of the orchestration.
          enum:
            - draft
            - running
            - completed
            - stopped
          example: running
        start_time:
          type: string
          format: date-time
          description: Date and time when the orchestration started.
          example: '2017-07-06T14:09:18'
        recurrence:
          type: object
          properties:
            end_time:
              type: string
              format: date-time
              description: End date and time for the recurrence.
              example: '2017-07-22T23:59:59'
            repeat_unit:
              type: string
              enum:
                - WEEKLY
                - DAILY
                - MONTHLY
                - YEARLY
              description: Unit for recurrence frequency.
              example: WEEKLY
            repeat_frequency:
              type: integer
              description: How often the recurrence unit repeats.
              example: 2
        capping:
          type: integer
          description: Maximum number of times the recurring orchestration can run.
          example: 2
    TriggerAutomation:
      type: object
      title: Trigger Automation
      description: Details for a trigger orchestration.
      properties:
        id:
          type: string
          description: Unique identifier for the orchestration.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        type:
          type: string
          enum:
            - trigger
        channels:
          type: array
          items:
            type: string
            enum:
              - push
              - sms
              - email
          description: Channels used by the orchestration.
          example:
            - push
        platforms:
          type: array
          items:
            type: string
            enum:
              - ios
              - android
              - web
          description: Platforms targeted by the orchestration.
          example:
            - ios
            - android
        source:
          type: string
          description: Source of the orchestration creation.
          example: dashboard
        created_date:
          type: string
          format: date-time
          description: Date and time when the orchestration was created.
          example: '2017-03-02T09:43:17'
        name:
          type: string
          description: Name of the orchestration.
          example: Test Campaign 1
        labels:
          type: array
          items:
            type: string
          description: Labels associated with the orchestration.
          example:
            - LABEL1
            - LABEL2
        status:
          type: string
          description: Current status of the orchestration.
          enum:
            - draft
            - running
            - completed
            - stopped
          example: running
        start_time:
          type: string
          format: date-time
          description: Date and time when the orchestration started.
          example: '2017-07-06T14:09:18'
        capping:
          type: integer
          description: Maximum number of times the trigger orchestration can run.
          example: 2
        end_time:
          type: string
          format: date-time
          description: End date and time for the trigger orchestration.
          example: '2017-03-10T09:43:17'
        nbr_steps:
          type: string
          description: Total number of steps in the trigger orchestration.
          example: '5'
        nbr_message_steps:
          type: string
          description: Number of message steps in the trigger orchestration.
          example: '2'
        message_steps:
          type: array
          items:
            type: object
            properties:
              step_name:
                type: string
                description: The name of the step.
                example: Initial Message
              step_id:
                type: string
                description: The API identifier of the step.
                example: step_123
    CampaignAndRecurringStats:
      type: object
      title: Campaign and Recurring Stats
      description: Statistics about a Campaign or Recurring orchestration.
      properties:
        id:
          type: string
          description: Unique identifier for the orchestration.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        details:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date
                example: '2025-03-18'
                description: Date of the statistic.
              versions:
                type: array
                description: >-
                  Statistics about each version of the orchestration when A/B
                  testing.
                items:
                  type: object
                  properties:
                    version:
                      type: string
                      description: The version identifier, ranging from `a` to `d`.
                      example: a
                    sent:
                      type: integer
                      example: 972
                      description: Number of messages sent.
                    delivered:
                      type: integer
                      example: 98
                      description: Number of messages delivered.
                    sent_optin:
                      type: integer
                      example: 843
                      description: Number of messages sent to opt-in users.
                    unique_open:
                      type: integer
                      example: 75
                      description: Number of unique open of the message.
                    total_open:
                      type: integer
                      example: 90
                      description: Total number of opened messages.
                    unique_machine_open:
                      type: integer
                      example: 3
                      description: Number of unique machine open of the message.
                    unique_click:
                      type: integer
                      example: 10
                      description: Number of unique click on the message.
                    total_click:
                      type: integer
                      example: 25
                      description: Total number of clicks on the message.
                    spam:
                      type: integer
                      example: 3
                      description: Number of messages flagged as spam.
                    unsubscribe:
                      type: integer
                      example: 2
                      description: Number of unsubscription from the message.
                    total_bounce:
                      type: integer
                      example: 2
                      description: Total number of rejected messages.
                    skipped:
                      type: integer
                      example: 10
                      description: Total number of skipped messages.
              sent:
                type: integer
                example: 972
                description: Number of messages sent.
              delivered:
                type: integer
                example: 98
                description: Number of messages delivered.
              sent_optin:
                type: integer
                example: 843
                description: Number of messages sent to opt-in users.
              unique_open:
                type: integer
                example: 75
                description: Number of unique open of the message.
              total_open:
                type: integer
                example: 90
                description: Total number of opened messages.
              unique_machine_open:
                type: integer
                example: 3
                description: Number of unique machine open of the message.
              unique_click:
                type: integer
                example: 10
                description: Number of unique click on the message.
              total_click:
                type: integer
                example: 25
                description: Total number of clicks on the message.
              spam:
                type: integer
                example: 3
                description: Number of messages flagged as spam.
              unsubscribe:
                type: integer
                example: 2
                description: Number of unsubscription from the message.
              total_bounce:
                type: integer
                example: 2
                description: Total number of rejected messages.
              skipped:
                type: integer
                example: 10
                description: Total number of skipped messages.
    TriggerAutomationStats:
      type: object
      title: Trigger Automation Stats
      description: Statistics about a Trigger Automation orchestration.
      properties:
        id:
          type: string
          description: Unique identifier for the orchestration.
          example: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
        details:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date
                example: '2025-03-18'
                description: Date of the statistic.
              message_steps:
                type: array
                description: Statistics about each message steps.
                items:
                  type: object
                  properties:
                    step_id:
                      type: string
                      description: The API identifier of the step.
                      example: step_0664hyh918hr1gnzka9py5t62nrc0e1q
                    sent:
                      type: integer
                      example: 972
                      description: Number of messages sent.
                    delivered:
                      type: integer
                      example: 98
                      description: Number of messages delivered.
                    sent_optin:
                      type: integer
                      example: 843
                      description: Number of messages sent to opt-in users.
                    unique_open:
                      type: integer
                      example: 75
                      description: Number of unique open of the message.
                    total_open:
                      type: integer
                      example: 90
                      description: Total number of opened messages.
                    unique_machine_open:
                      type: integer
                      example: 3
                      description: Number of unique machine open of the message.
                    unique_click:
                      type: integer
                      example: 10
                      description: Number of unique click on the message.
                    total_click:
                      type: integer
                      example: 25
                      description: Total number of clicks on the message.
                    spam:
                      type: integer
                      example: 3
                      description: Number of messages flagged as spam.
                    unsubscribe:
                      type: integer
                      example: 2
                      description: Number of unsubscription from the message.
                    total_bounce:
                      type: integer
                      example: 2
                      description: Total number of rejected messages.
                    skipped:
                      type: integer
                      example: 10
                      description: Total number of skipped messages.
              sent:
                type: integer
                example: 972
                description: Number of messages sent.
              delivered:
                type: integer
                example: 98
                description: Number of messages delivered.
              sent_optin:
                type: integer
                example: 843
                description: Number of messages sent to opt-in users.
              unique_open:
                type: integer
                example: 75
                description: Number of unique open of the message.
              total_open:
                type: integer
                example: 90
                description: Total number of opened messages.
              unique_machine_open:
                type: integer
                example: 3
                description: Number of unique machine open of the message.
              unique_click:
                type: integer
                example: 10
                description: Number of unique click on the message.
              total_click:
                type: integer
                example: 25
                description: Total number of clicks on the message.
              spam:
                type: integer
                example: 3
                description: Number of messages flagged as spam.
              unsubscribe:
                type: integer
                example: 2
                description: Number of unsubscription from the message.
              total_bounce:
                type: integer
                example: 2
                description: Total number of rejected messages.
              skipped:
                type: integer
                example: 10
                description: Total number of skipped messages.
  responses:
    '200':
      description: Request successful, campaign udpated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EmptyResponse'
    '201':
      description: Request successful, campaign created
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/schemas-SuccessResponse'
          examples:
            success:
              value:
                id: orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q
    '202':
      description: Request accepted, will be processed asynchronously
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/SuccessResponse'
          examples:
            success:
              value:
                code: SUCCESS
            identifierError:
              value:
                code: SUCCESS_WITH_PARTIAL_ERRORS
                errors:
                  - category: identifier
                    bulk_index: 1
                    reason: Missing profile identifier
            attributeError:
              value:
                code: SUCCESS_WITH_PARTIAL_ERRORS
                errors:
                  - category: attribute
                    bulk_index: 3
                    attribute: $timezone
                    reason: '`Pariso` is not a valid value for `$timezone`'
            attributeLimitError:
              value:
                code: SUCCESS_WITH_PARTIAL_ERRORS
                errors:
                  - category: attribute_limit
                    bulk_index: 1
                    reason: >-
                      Cannot set more than 50 attributes at once per operation.
                      Ignoring attributes.
            eventNameError:
              value:
                code: SUCCESS_WITH_PARTIAL_ERRORS
                errors:
                  - category: event_name
                    bulk_index: 0
                    event_index: 1
                    reason: '`ädd_to_cart` is not a valid event name'
            eventAttributeError:
              value:
                code: SUCCESS_WITH_PARTIAL_ERRORS
                errors:
                  - category: event_attribute
                    bulk_index: 1
                    event_index: 0
                    attribute: item_name
                    reason: >-
                      event `purchased_item` is invalid because `item_name` is
                      longer than 200 characters. The event has been ignored.
    '204':
      description: Request successful, campaign deleted
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EmptyResponse'
    '307':
      description: >-
        The resource requested can be found under the `Location` section of the
        response header.
      headers:
        Location:
          description: URI where the requested resource can be downloaded.
          schema:
            type: string
            format: uri
    '400':
      description: The request is malformed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingParameter:
              value:
                error_code: MISSING_PARAMETER
                error_message: '`name` is a required object and is missing'
            malformedParameter:
              value:
                error_code: MALFORMED_PARAMETER
                error_message: Pariso is not a valid `$timezone` value
            malformedJsonBody:
              value:
                error_code: MALFORMED_JSON_BODY
                error_message: '`audio` is not a valid key of the media object'
    '401':
      description: The Rest API Key is not valid for this project
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: AUTHENTICATION_INVALID
            error_message: Authentication credentials are invalid
    '404':
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: NOT_FOUND
            error_message: The requested resource doesn't exist
    '409':
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalidStatus:
              value:
                error_code: CONFLICT
                error_message: The requested export `status` is not valid.
    '429':
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: TOO_MANY_REQUESTS
            error_message: You have made too many requests, please wait for a while
    '500':
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: SERVER_ERROR
            error_message: Internal server error
    '503':
      description: Batch's services are under maintenance. Please try again later
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: MAINTENANCE_ERROR
            error_message: The API is under maintenance
    asyncResponse:
      description: >
        If the POST to the API endpoint is successful you will receive an HTTP
        202 confirmation and an indexing token. <br/>Once you get your indexing
        token, you can use it to check the indexing state with the view action.
      content:
        application/json:
          schema:
            type: object
            properties:
              indexing_token:
                type: string
    responses-201:
      description: Resource created successfully
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EmptyResponse'
    responses-202:
      description: Request accepted for asynchronous processing
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EmptyResponse'
    responses-asyncResponse:
      description: >
        If the POST to the API endpoint is successful you will receive an HTTP
        202 confirmation and an indexing token. <br/>Once you get your indexing
        token, you can use it to check the indexing state with the view action.
      content:
        application/json:
          schema:
            type: object
            properties:
              indexing_token:
                type: string
                example: eqRqTF7xFznYoG0MLs1sIqM1JhmhGLTZ7I5NtM5f
