---
title: Ingest events
slug: reference/ingest-events
docTags: 
createdAt: 2025-01-21T18:39:14.860Z
---

{
  "id": "YbM19lVJ07YCL7COagxKC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/ingest",
    "servers": [
      {
        "url": "https://app.amberflo.io/ingest"
      }
    ],
    "name": "Ingest events",
    "description": "<p>Ingests meter usage events for processing and aggregation. Send a single event object or an array of events for batch processing.</p>\n<p>Required fields per event:</p>\n<ul>\n<li><code>meterApiName</code>: Must match an existing meter's API name</li>\n<li><code>customerId</code>: Identifier for the customer generating usage</li>\n<li><code>meterTimeInMillis</code>: Event timestamp in Unix milliseconds</li>\n<li><code>meterValue</code>: Usage amount (numeric value)</li>\n</ul>\n<p>Optional fields:</p>\n<ul>\n<li><code>dimensions</code>: Key-value pairs for event categorization and filtering</li>\n<li><code>uniqueId</code>: Custom identifier for event deduplication</li>\n</ul>\n<p>Events are validated against existing meters and customer records. Invalid events are rejected with detailed error messages.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "array",
          "description": "Message structure for ingesting meter usage events with flexible value and variant support",
          "customType": "ingestion.IngestMessage.in[]",
          "schema": [
            {
              "name": "uniqueId",
              "kind": "optional",
              "type": "string",
              "description": "Set this value in order to differentiate otherwise identical (same meter, customer, time, and dimensions) events.",
              "example": ""
            },
            {
              "name": "meterApiName",
              "kind": "optional",
              "type": "string",
              "description": "`meterApiName` as defined in [Meter API](ref:post_meters).\n\nRequired if `values` is not set or empty.",
              "example": ""
            },
            {
              "name": "meterValue",
              "kind": "optional",
              "type": "number",
              "description": "Meter value to be ingested. This will be used for aggregation.\n\nRequired if `values` is not set or empty.",
              "example": ""
            },
            {
              "name": "meterTimeInMillis",
              "kind": "required",
              "type": "integer<int64>",
              "description": "Meter event timestamp, in [Unix time](https://en.wikipedia.org/wiki/Unix_time) (milliseconds).",
              "example": 0
            },
            {
              "name": "customerId",
              "kind": "optional",
              "type": "string",
              "description": "`customerId` as defined in [Customer API](ref:post_customers).",
              "example": ""
            },
            {
              "name": "dimensions",
              "kind": "optional",
              "type": "map",
              "description": "Dimension values for keys defined in `dimensions` in [Meter API](ref:post_meters).",
              "example": "",
              "customType": "map<string, string>",
              "schema": []
            },
            {
              "name": "variants",
              "kind": "optional",
              "type": "array",
              "description": "When set, each entry will be merged with the main fields to form the resulting ingest messages. This is a more flexible alternative to the `values` field.\n\nMay not be used together with the `values` field.",
              "modelRef": "#/components/schemas/ingestion.IngestMessage.Variant.in",
              "customType": "ingestion.IngestMessage.Variant.in[]",
              "schema": [
                {
                  "name": "meterApiName",
                  "kind": "optional",
                  "type": "string",
                  "description": "Meter API name override for this variant. See the main `meterApiName` field.",
                  "example": ""
                },
                {
                  "name": "meterValue",
                  "kind": "optional",
                  "type": "number",
                  "description": "Meter value override for this variant. See the main `meterValue` field.",
                  "example": ""
                },
                {
                  "name": "dimensions",
                  "kind": "optional",
                  "type": "map",
                  "description": "Dimension overrides for this variant. See the main `dimensions` field.",
                  "example": "",
                  "customType": "map<string, string>",
                  "schema": []
                }
              ]
            },
            {
              "name": "values",
              "kind": "optional",
              "type": "map",
              "description": "Map of `meterApiName` to `meterValue`. Use this field instead of the `meterApiName` and `meterValue` fields if you want to send multiple values in a single ingest message\n\nMay only be used if the fields `meterApiName`, `meterValue`, and `variants` are not.",
              "example": "",
              "customType": "map<string, number>",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/ingestion.IngestMessage.in",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "string",
            "description": "",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "0DbWvyTl95iSZixZ_fvSZ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/ingest \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '[\n     {\n     \"meterTimeInMillis\": 0\n     }\n     ]'"
        },
        {
          "id": "xJ5fsAXvXAb2idCDO_R6C",
          "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   {\n      \"meterTimeInMillis\": 0\n   }\n]);\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/ingest\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Bf1A9Y-bDr17zxQZXShOa",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/ingest\")\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   {\n      \"meterTimeInMillis\": 0\n   }\n])\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "WOE_Bw0_kNzZ1Mh2sVb75",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/ingest\"\n\npayload = json.dumps([\n   {\n      \"meterTimeInMillis\": 0\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"
        }
      ],
      "selectedLanguageId": "0DbWvyTl95iSZixZ_fvSZ"
    },
    "results": {
      "languages": [
        {
          "id": "M54_XFqJjAr5haGqvuCi5",
          "language": "200",
          "code": "// Successful request\n\"\""
        }
      ],
      "selectedLanguageId": "M54_XFqJjAr5haGqvuCi5"
    }
  },
  "children": [
    {
      "text": "",
      "id": "SQUUGLE8ypcHLV0hS0g-G"
    }
  ]
}