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

# POST /api/public/apps/batch

> The batch method lets you send a series of identify, group, track, page and screen requests in a single batch, saving on outbound requests.

The following is an example of a batch body.

```json example body theme={null}
{
  "batch": [
    {
      "type": "track",
      "event": "Signed Up",
      "userId": "1043",
      "properties": {
        "plan": "Enterprise"
      },
      "messageId": "1ff51c9c-4929-45de-8914-3bb878be8c4a"
    },
    {
      "type": "identify",
      "userId": "532",
      "traits": {
        "email": "john@email.com"
      },
      "messageId": "6f5f436d-8534-4070-8023-d18f8b78ed39"
    }
  ]
}
```


## OpenAPI

````yaml POST /api/public/apps/batch
openapi: 3.1.0
info:
  title: Tranthor API
  description: Tranthor API Swagger Documentation
  version: 0.0.1
servers: []
security: []
paths:
  /api/public/apps/batch:
    post:
      tags:
        - Public Apps
      description: >-
        The batch method lets you send a series of identify, group, track, page
        and screen requests in a single batch, saving on outbound requests.
      parameters:
        - schema:
            type: string
          example: >-
            Basic
            YzQ2MDllYjMtYTE2OC00MGI5LWI1ZWMtYTdiYTFkYzY2NWYwOjI5NGYwYjkyOTI1YWZhNzM=
          in: header
          name: authorization
          required: true
          description: >-
            Authorization header for the request, in the format `Bearer
            <token>`. You can collect your token at
            https://app.tranthor.com/dashboard/settings#write-key.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                batch:
                  type: array
                  items:
                    anyOf:
                      - anyOf:
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              type:
                                type: string
                                enum:
                                  - identify
                              traits:
                                description: >-
                                  Free-form dictionary of traits of the user,
                                  like email or name. Can contain arbitrary JSON
                                  values.
                                examples:
                                  - name: Michael Scott
                                    items:
                                      - id: 1
                                        name: Paper
                                      - id: 2
                                        name: Stapler
                                type: object
                                additionalProperties: {}
                              userId:
                                description: >-
                                  Unique identifier for the user. Should be the
                                  id of the user in your system. Only applicable
                                  to logged in users.
                                examples:
                                  - '1043'
                                  - user-123
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                type: string
                            required:
                              - messageId
                              - type
                              - userId
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              type:
                                type: string
                                enum:
                                  - identify
                              traits:
                                description: >-
                                  Free-form dictionary of traits of the user,
                                  like email or name. Can contain arbitrary JSON
                                  values.
                                examples:
                                  - name: Michael Scott
                                    items:
                                      - id: 1
                                        name: Paper
                                      - id: 2
                                        name: Stapler
                                type: object
                                additionalProperties: {}
                              anonymousId:
                                description: >-
                                  Identifier for a logged out user. It can be
                                  any pseudo-unique identifier, for example a
                                  session Id or a UUID.
                                examples:
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                  - session-123
                                type: string
                            required:
                              - messageId
                              - type
                              - anonymousId
                      - anyOf:
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              files:
                                type: array
                                items:
                                  description: File associated with user event.
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - Base64Encoded
                                    name:
                                      type: string
                                    mimeType:
                                      type: string
                                    data:
                                      type: string
                                  required:
                                    - type
                                    - name
                                    - mimeType
                                    - data
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              event:
                                description: Name of the action that a user has performed.
                                examples:
                                  - COURSE_CLICKED
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  event, like revenue or product name. Can
                                  contain arbitrary JSON values.
                                examples:
                                  - title: Intro to customer engagement
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - track
                              userId:
                                description: >-
                                  Unique identifier for the user. Should be the
                                  id of the user in your system. Only applicable
                                  to logged in users.
                                examples:
                                  - '1043'
                                  - user-123
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                type: string
                            required:
                              - messageId
                              - event
                              - type
                              - userId
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              files:
                                type: array
                                items:
                                  description: File associated with user event.
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - Base64Encoded
                                    name:
                                      type: string
                                    mimeType:
                                      type: string
                                    data:
                                      type: string
                                  required:
                                    - type
                                    - name
                                    - mimeType
                                    - data
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              event:
                                description: Name of the action that a user has performed.
                                examples:
                                  - COURSE_CLICKED
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  event, like revenue or product name. Can
                                  contain arbitrary JSON values.
                                examples:
                                  - title: Intro to customer engagement
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - track
                              anonymousId:
                                description: >-
                                  Identifier for a logged out user. It can be
                                  any pseudo-unique identifier, for example a
                                  session Id or a UUID.
                                examples:
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                  - session-123
                                type: string
                            required:
                              - messageId
                              - event
                              - type
                              - anonymousId
                      - anyOf:
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              name:
                                description: Name of the page visited by the user.
                                examples:
                                  - Home
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  page, like url and referrer. Can contain
                                  arbitrary JSON values.
                                examples:
                                  - title: My Site
                                    url: http://www.site.com
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - page
                              userId:
                                description: >-
                                  Unique identifier for the user. Should be the
                                  id of the user in your system. Only applicable
                                  to logged in users.
                                examples:
                                  - '1043'
                                  - user-123
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                type: string
                            required:
                              - messageId
                              - type
                              - userId
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              name:
                                description: Name of the page visited by the user.
                                examples:
                                  - Home
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  page, like url and referrer. Can contain
                                  arbitrary JSON values.
                                examples:
                                  - title: My Site
                                    url: http://www.site.com
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - page
                              anonymousId:
                                description: >-
                                  Identifier for a logged out user. It can be
                                  any pseudo-unique identifier, for example a
                                  session Id or a UUID.
                                examples:
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                  - session-123
                                type: string
                            required:
                              - messageId
                              - type
                              - anonymousId
                      - anyOf:
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              name:
                                description: Name of the screen visited by the user.
                                examples:
                                  - Home
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  screen, like title.
                                examples:
                                  - title: My Screen
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - screen
                              userId:
                                description: >-
                                  Unique identifier for the user. Should be the
                                  id of the user in your system. Only applicable
                                  to logged in users.
                                examples:
                                  - '1043'
                                  - user-123
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                type: string
                            required:
                              - messageId
                              - type
                              - userId
                          - type: object
                            properties:
                              messageId:
                                description: >-
                                  Unique identifier for the message, used as an
                                  idempotency key for safe retries. Can provide
                                  a UUID.
                                examples:
                                  - 23d04926-78e5-4ebc-853f-f26c84ff629e
                                type: string
                              timestamp:
                                description: >-
                                  ISO 8601 formatted timestamp of when the event
                                  occurred. If not provided, the current server
                                  time will be used.
                                examples:
                                  - '2024-04-22T07:00:00.000Z'
                                type: string
                              context:
                                description: >-
                                  Provides metadata about the user submitting
                                  the event and the context in which the event
                                  occurred.
                                examples:
                                  - ip: 192.0.2.1
                                type: object
                                additionalProperties: {}
                              name:
                                description: Name of the screen visited by the user.
                                examples:
                                  - Home
                                type: string
                              properties:
                                description: >-
                                  Free-form dictionary of properties of the
                                  screen, like title.
                                examples:
                                  - title: My Screen
                                type: object
                                additionalProperties: {}
                              type:
                                type: string
                                enum:
                                  - screen
                              anonymousId:
                                description: >-
                                  Identifier for a logged out user. It can be
                                  any pseudo-unique identifier, for example a
                                  session Id or a UUID.
                                examples:
                                  - 0a58e5e4-c753-477e-a6c4-f9b0e3396b9b
                                  - session-123
                                type: string
                            required:
                              - messageId
                              - type
                              - anonymousId
                context:
                  description: >-
                    Provides metadata about the user submitting the event and
                    the context in which the event occurred.
                  type: object
                  additionalProperties: {}
                  example:
                    ip: 192.0.2.1
              required:
                - batch
            example:
              batch:
                - type: track
                  event: Signed Up
                  userId: '1043'
                  properties:
                    plan: Enterprise
                  messageId: 1ff51c9c-4929-45de-8914-3bb878be8c4a
                - type: identify
                  userId: '532'
                  traits:
                    email: john@email.com
                  messageId: 6f5f436d-8534-4070-8023-d18f8b78ed39
        required: true
      responses:
        '204':
          description: An empty String
          content:
            application/json:
              schema:
                description: An empty String
                type: string
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
      security:
        - publicWriteKey: []
components:
  securitySchemes:
    publicWriteKey:
      type: apiKey
      description: >-
        Authorization header for the request, in the format `Bearer <token>`.
        You can collect your token at
        https://app.tranthor.com/dashboard/settings#write-key.
      name: PublicWriteKey
      in: header

````