---
title: /v2/events/batch
slug: v2eventsbatch
docTags: 
createdAt: 2026-07-05T23:31:07.866Z
---

{
  "id": "L4dMPjRTGGZihBi4Tv69U",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.throughlinecare.com/v2/events/batch",
    "description": "<p>Submit a batch of helpline events (helplineDisplay and/or helplineClick). Returns 202 immediately with a jobId; poll the returned statusUrl for the per-item result. Duplicate detection is out of scope; retrying a batch resubmits the same events.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "atomic",
          "type": "boolean",
          "description": "<p>Reject the whole batch if any event is invalid. When false (the default), valid events are accepted and only invalid ones are dropped. Per-item errors are reported in the status payload, indexed to each event's position in the batch.</p>",
          "default": false
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "EventsBatchSubmit",
          "type": "object",
          "description": "<p>Submit a batch of helpline events (helplineDisplay and/or helplineClick). Returns 202 immediately with a jobId; poll the returned statusUrl for the per-item result. Duplicate detection is out of scope; retrying a batch resubmits the same events.</p>",
          "customType": "EventsBatchSubmit",
          "schema": [
            {
              "name": "events",
              "kind": "optional",
              "type": "array",
              "description": "<p>The events to record. Up to 1,000,000 events (150 MiB) per batch.</p>",
              "modelRef": "#/definitions/BatchEvent",
              "customType": "BatchEvent[]",
              "schema": [
                {
                  "name": "type",
                  "kind": "required",
                  "type": "string<helplineDisplay | helplineClick>",
                  "description": "The kind of event being recorded.",
                  "example": "helplineDisplay",
                  "enum": [
                    "helplineDisplay",
                    "helplineClick"
                  ]
                },
                {
                  "name": "helplineId",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>Id of the helpline. Required, except on a display event that records that no helpline was shown.</p>",
                  "example": "crisis-text-line"
                },
                {
                  "name": "sessionId",
                  "kind": "required",
                  "type": "string",
                  "description": "<p>Client-generated session identifier.</p>",
                  "example": "3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f"
                },
                {
                  "name": "timestamp",
                  "kind": "required",
                  "type": "string<date-time>",
                  "description": "ISO 8601 timestamp of when the event occurred.",
                  "example": "2026-07-05T12:34:56Z",
                  "format": "date-time"
                },
                {
                  "name": "contactMethod",
                  "kind": "optional",
                  "type": "string<phone | sms | onlineChat | website | tty | whatsapp | reportingForm>",
                  "description": "<p>How the user reached the helpline. Required for click events; not used for display events.</p>",
                  "example": "phone",
                  "enum": [
                    "phone",
                    "sms",
                    "onlineChat",
                    "website",
                    "tty",
                    "whatsapp",
                    "reportingForm"
                  ]
                },
                {
                  "name": "noDisplay",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "<p>For display events only: record that the API was queried but no helpline was shown. Mutually exclusive with the helpline id.</p>"
                }
              ]
            }
          ],
          "modelRef": "#/definitions/EventsBatchSubmit",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "bearerAuth",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "description": "<p>Enter the token with the \"Bearer: \" prefix e.g. \"Bearer ABC...\"</p>",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "202",
        "description": "Batch accepted.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Malformed request.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "413",
        "description": "Payload too large.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "503",
        "description": "Storage unavailable.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "jzUZyL2oNCJZkfsdLaWmO",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"events\": [\n      {\n         \"type\": \"helplineDisplay\",\n         \"sessionId\": \"3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f\",\n         \"timestamp\": \"2026-07-05T12:34:56Z\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.throughlinecare.com/v2/events/batch?atomic=boolean\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "D5dAWDicfAc4fcRKCaN4o",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.throughlinecare.com/v2/events/batch?atomic=boolean\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"events\": [\n      {\n         \"type\": \"helplineDisplay\",\n         \"sessionId\": \"3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f\",\n         \"timestamp\": \"2026-07-05T12:34:56Z\"\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "bHJ2mJnfRnKUnEDKz05Kv",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.throughlinecare.com/v2/events/batch?atomic=boolean\"\n\npayload = json.dumps({\n   \"events\": [\n      {\n         \"type\": \"helplineDisplay\",\n         \"sessionId\": \"3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f\",\n         \"timestamp\": \"2026-07-05T12:34:56Z\"\n      }\n   ]\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        },
        {
          "id": "-NUstred1-Z_X-iPpjR1J",
          "language": "java",
          "label": "Java",
          "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n   .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"events\\\": [\\n    {\\n      \\\"type\\\": \\\"helplineDisplay\\\",\\n      \\\"sessionId\\\": \\\"3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f\\\",\\n      \\\"timestamp\\\": \\\"2026-07-05T12:34:56Z\\\"\\n    }\\n  ]\\n}\");\nRequest request = new Request.Builder()\n   .url(\"https://api.throughlinecare.com/v2/events/batch?atomic=boolean\")\n   .method(\"POST\", body)\n   .addHeader(\"accept\", \"application/json\")\n   .addHeader(\"content-type\", \"application/json\")\n   .build();\nResponse response = client.newCall(request).execute();"
        },
        {
          "id": "HdKHnAPpu1GtdrWUhbZDq",
          "language": "swift",
          "label": "Swift",
          "code": "let parameters = \"{\\n  \\\"events\\\": [\\n    {\\n      \\\"type\\\": \\\"helplineDisplay\\\",\\n      \\\"sessionId\\\": \\\"3f0c8a2e-1d4b-4c9a-9e2f-7a1b2c3d4e5f\\\",\\n      \\\"timestamp\\\": \\\"2026-07-05T12:34:56Z\\\"\\n    }\\n  ]\\n}\"\nlet postData = parameters.data(using: .utf8)\n\nvar request = URLRequest(url: URL(string: \"https://api.throughlinecare.com/v2/events/batch?atomic=boolean\")!,timeoutInterval: Double.infinity)\nrequest.addValue(\"application/json\", forHTTPHeaderField: \"accept\")\nrequest.addValue(\"application/json\", forHTTPHeaderField: \"content-type\")\n\nrequest.httpMethod = \"POST\"\nrequest.httpBody = postData\n\nlet task = URLSession.shared.dataTask(with: request) { data, response, error in \n   guard let data = data else {\n      print(String(describing: error))\n      return\n   }\n   print(String(data: data, encoding: .utf8)!)\n}\n\ntask.resume()\n"
        }
      ],
      "selectedLanguageId": "jzUZyL2oNCJZkfsdLaWmO"
    },
    "results": {
      "languages": [
        {
          "id": "QdgcrxsATzr7h7tupfjwM",
          "language": "202",
          "code": "// Batch accepted.\n"
        },
        {
          "id": "SL34lyLd-pX_30P6uZHDG",
          "language": "400",
          "code": "// Malformed request.\n"
        },
        {
          "id": "EPIQq9IjvYMa3LciUD0jE",
          "language": "401",
          "code": "// Unauthorized.\n"
        },
        {
          "id": "bAeftHBitttWr50x9moQn",
          "language": "413",
          "code": "// Payload too large.\n"
        },
        {
          "id": "LAl12HAe_0M4g8ye_5Wy2",
          "language": "503",
          "code": "// Storage unavailable.\n"
        }
      ],
      "selectedLanguageId": "QdgcrxsATzr7h7tupfjwM"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}