---
title: Ingest Raw Usage
slug: ingest-raw-usage
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "CJNHTwPEzqiTJZNTISy9c",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/usage/raw-usage",
    "servers": [
      {
        "url": "https://api.nue.io/usage/raw-usage",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/usage/raw-usage",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Ingest Raw Usage",
    "description": "Submit raw usage data for processing and rating. Raw usage represents the actual consumption before pricing rules are applied. This is typically called by your systems to report customer usage of metered services.",
    "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": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Raw usage data with transaction ID for idempotency",
          "schema": [
            {
              "name": "transactionId",
              "kind": "required",
              "type": "string",
              "description": "<p>Unique identifier for this request (UUID recommended). Used for idempotency to prevent duplicate submissions.</p>",
              "example": "txn-12345-abcde"
            },
            {
              "name": "data",
              "kind": "required",
              "type": "array",
              "description": "",
              "example": "",
              "itemType": "object",
              "customType": "object[]",
              "schema": [
                {
                  "name": "customerId",
                  "kind": "optional",
                  "type": "string",
                  "description": "Customer identifier"
                },
                {
                  "name": "subscriptionId",
                  "kind": "optional",
                  "type": "string",
                  "description": "Subscription identifier for the usage"
                },
                {
                  "name": "timestamp",
                  "kind": "required",
                  "type": "string<date-time>",
                  "description": "When the usage occurred",
                  "format": "date-time"
                },
                {
                  "name": "quantity",
                  "kind": "required",
                  "type": "number",
                  "description": "Amount of usage consumed"
                }
              ]
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Raw usage data submitted successfully",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "transactionId",
                "kind": "optional",
                "type": "string",
                "description": "Transaction ID that was processed"
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "r0Wb9djGRwj-aZKwQIMkz",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/usage/raw-usage \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"transactionId\": \"txn-12345-abcde\",\n     \"data\": [\n     {\n     \"timestamp\": \"\",\n     \"quantity\": \"\"\n     }\n     ]\n     }'"
        },
        {
          "id": "yppBzthiOjbwHBBa4ZqxR",
          "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   \"transactionId\": \"txn-12345-abcde\",\n   \"data\": [\n      {\n         \"timestamp\": \"\",\n         \"quantity\": \"\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/usage/raw-usage\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "LLrlSEucDkxxEui9Rtzew",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/usage/raw-usage\")\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   \"transactionId\": \"txn-12345-abcde\",\n   \"data\": [\n      {\n         \"timestamp\": \"\",\n         \"quantity\": \"\"\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ic_UUMRCuMf0wN0ea5N5H",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/usage/raw-usage\"\n\npayload = json.dumps({\n   \"transactionId\": \"txn-12345-abcde\",\n   \"data\": [\n      {\n         \"timestamp\": \"\",\n         \"quantity\": \"\"\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"
        }
      ],
      "selectedLanguageId": "r0Wb9djGRwj-aZKwQIMkz"
    },
    "results": {
      "languages": [
        {
          "id": "KVDS4jCqOOX_AGu3dlsCZ",
          "language": "201",
          "code": "// Raw usage data submitted successfully\n{\n  \"transactionId\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "KVDS4jCqOOX_AGu3dlsCZ"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}