---
title: Supply Forecast Inventory
slug: fourkites-api-reference/supply-forecast-inventory
icon: {"apiMethod":"POST"}
createdAt: 2025-10-27T12:37:10.000Z
---

The Supply Forecast Ingestion API receives supply forecasts from WMS forecasting systems and feeds the event-driven inventory processing pipeline. Submissions are accepted asynchronously: the API acknowledges receipt and returns a `request_id`, then validates and processes the payload downstream.

:::hint{type="warning"}
A 202 confirms receipt, not validity. Every rule below is applied after the response is returned. Points that fail are recorded in FourKites service logs only — no error reaches the caller, and there is no callback today. To confirm a forecast landed, read it back through the inventory projection APIs.
:::

### Validation Rules

Two groups, and the difference matters: the first discards everything you sent, the second discards only the point at fault.

**Whole submission is rejected — nothing is stored:**

- `forecasts` is missing or empty
- `forecasts` contains more than 500 entries
- any `forecastData` contains more than 500 points
- any date is not in `YYYY-MM-DD` format

**Only the offending point or entry is rejected — everything else is stored:**

- `forecastData` is missing or empty — that entry only
- `productId` or `facilityId` missing, or over 100 characters
- `quantityUom` over 10 characters
- `date` missing on a point
- `quantity` missing, or negative
- the same date appears twice in one `forecastData` array

**Why the split.** A size breach or an unreadable date is a fault in how the submission was built, so the whole submission is refused before any of it is stored. Everything else is a fault in one row, so only that row is dropped.

Neither is reported back to you. Both are recorded in FourKites service logs against the `request_id`.

### Date format

Dates must be `YYYY-MM-DD`, for example `2024-08-05`. Other formats — `08/05/2024`, `2024-8-5`, `05-Aug-2024` — are not accepted, and a single one of them discards the entire submission.

An absent date is different: that point alone is rejected and its siblings are stored normally.

### Processing granularity

Daily or weekly handling is taken from your company's forecast configuration, not from the request. Dates are stored exactly as submitted; the API does not snap them to week starts or redistribute them. Where no configuration exists, forecasts are stored as daily.

:::ApiMethodV2
```json
{
  "name": "Production",
  "method": "POST",
  "url": "https://api.fourkites.com/api/v1/async/forecast/supply",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "4wgDRM6EKcGac3El9lEBN",
        "language": "curl",
        "code": "curl --location 'https://api.fourkites.com/api/v1/async/forecast/supply' \\\n--header 'Content-Type: application/json' \\\n--header 'apikey: APIKEY' \\\n--data '{\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180.0\n        },\n        {\n          \"date\": \"2024-08-06\", \n          \"quantity\": 150.0\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200.0\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"dataSource\": \"WMS_FORECAST_ENGINE\"\n      }\n    }\n  ]\n}'",
        "customLabel": ""
      },
      {
        "id": "JfkJa4ySt_xGG89YTyvfh",
        "language": "java",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://api.fourkites.com/api/v1/async/forecast/supply\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"apikey\", \"APIKEY\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "customLabel": ""
      },
      {
        "id": "5dC2AAhUvNHoCxposLeKN",
        "language": "javascript",
        "code": "var settings = {\n  \"url\": \"https://api.fourkites.com/api/v1/async/forecast/supply\",\n  \"method\": \"POST\",\n  \"timeout\": 0,\n  \"headers\": {\n    \"Content-Type\": \"application/json\",\n    \"apikey\": \"APIKEY\"\n  },\n  \"data\": JSON.stringify({\n    \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n    \"forecasts\": [\n      {\n        \"productId\": \"WIRE-BEL-COA-001\",\n        \"facilityId\": \"442344\",\n        \"quantityUom\": \"EA\",\n        \"forecastData\": [\n          {\n            \"date\": \"2024-08-05\",\n            \"quantity\": 180\n          },\n          {\n            \"date\": \"2024-08-06\",\n            \"quantity\": 150\n          },\n          {\n            \"date\": \"2024-08-07\",\n            \"quantity\": 200\n          }\n        ],\n        \"referenceAttributes\": {\n          \"forecastModel\": \"ML_TIMESERIES_V3\",\n          \"planningGroup\": \"WIRE_CABLE\",\n          \"seasonalityFactor\": 1.2,\n          \"promotionFlag\": false,\n          \"forecastAccuracy\": 0.87,\n          \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n          \"dataSource\": \"WMS_FORECAST_ENGINE\",\n          \"supplierLeadTime\": 14,\n          \"minimumOrderQuantity\": 500\n        }\n      }\n    ]\n  }),\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});",
        "customLabel": ""
      },
      {
        "id": "T1kLo3ROSupAbVto0dmxO",
        "language": "swift",
        "code": "let parameters = \"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\"\nlet postData = parameters.data(using: .utf8)\n\nvar request = URLRequest(url: URL(string: \"https://api.fourkites.com/api/v1/async/forecast/supply\")!,timeoutInterval: Double.infinity)\nrequest.addValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\nrequest.addValue(\"APIKEY\", forHTTPHeaderField: \"apikey\")\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",
        "customLabel": ""
      },
      {
        "id": "--Up5EjPTotuJnZJ1s2iI",
        "language": "csharp",
        "code": "var client = new HttpClient();\nvar request = new HttpRequestMessage(HttpMethod.Post, \"https://api.fourkites.com/api/v1/async/forecast/supply\");\nrequest.Headers.Add(\"apikey\", \"APIKEY\");\nvar content = new StringContent(\"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\", null, \"application/json\");\nrequest.Content = content;\nvar response = await client.SendAsync(request);\nresponse.EnsureSuccessStatusCode();\nConsole.WriteLine(await response.Content.ReadAsStringAsync());\n",
        "customLabel": ""
      },
      {
        "id": "zjEKVhh5n1yTKjBDYDrI3",
        "language": "go",
        "code": "package main\n\nimport (\n  \"fmt\"\n  \"strings\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n\n  url := \"https://api.fourkites.com/api/v1/async/forecast/supply\"\n  method := \"POST\"\n\n  payload := strings.NewReader(`{\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180.0\n        },\n        {\n          \"date\": \"2024-08-06\", \n          \"quantity\": 150.0\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200.0\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": false,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n}`)\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, payload)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"Content-Type\", \"application/json\")\n  req.Header.Add(\"apikey\", \"APIKEY\")\n\n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}",
        "customLabel": ""
      },
      {
        "id": "vHjYv1Gp6BXs2_5Gv1syz",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fourkites.com/api/v1/async/forecast/supply\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = \"application/json\"\nrequest[\"apikey\"] = \"APIKEY\"\nrequest.body = JSON.dump({\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180\n        },\n        {\n          \"date\": \"2024-08-06\",\n          \"quantity\": 150\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": false,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      },
      {
        "id": "pZu0iFSZ8Jylnllf-wXiP",
        "language": "python",
        "code": "import http.client\nimport json\n\nconn = http.client.HTTPSConnection(\"api.fourkites.com\")\npayload = json.dumps({\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180\n        },\n        {\n          \"date\": \"2024-08-06\",\n          \"quantity\": 150\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": False,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n})\nheaders = {\n  'Content-Type': 'application/json',\n  'apikey': 'APIKEY'\n}\nconn.request(\"POST\", \"/api/v1/async/forecast/supply\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "4wgDRM6EKcGac3El9lEBN"
  },
  "results": {
    "languages": [
      {
        "id": "bL0XUOQALkYMh6AagovNz",
        "language": "202",
        "code": "{\n  \"request_id\": \"FCT-SUPPLY-2024-07-30-001\"\n}",
        "customLabel": ""
      },
      {
        "id": "D0wVV0kWLO6749Zmp3uY2",
        "language": "401",
        "code": "{\n  \"error_message\": \"Unauthorized access.\"\n}",
        "customLabel": ""
      },
      {
        "id": "UCXMLh4K5gw5pkGJ39inA",
        "language": "500",
        "code": "{\n  \"request_id\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"error_message\": \"Failed to process supply forecast data.\"\n}",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "bL0XUOQALkYMh6AagovNz"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "name": "message_id",
        "kind": "optional",
        "type": "string",
        "description": "Correlation identifier returned as request_id. Falls back to the body's messageId, then to a generated identifier."
      },
      {
        "name": "company_id",
        "kind": "optional",
        "type": "string",
        "description": "Resolved from your API key when omitted. Most callers should omit it."
      }
    ],
    "headerParameters": [
      {
        "name": "Content-Type",
        "kind": "required",
        "type": "string",
        "description": "application/json"
      },
      {
        "name": "apikey",
        "kind": "required",
        "type": "string",
        "description": "Your API key. Determines the company the forecast is stored against."
      }
    ],
    "bodyDataParameters": [
      {
        "name": "messageId",
        "kind": "optional",
        "type": "string",
        "description": "Message identifier, used as the request_id fallback. Not checked for uniqueness and does not deduplicate submissions."
      },
      {
        "name": "forecasts",
        "kind": "required",
        "type": "object",
        "description": "Forecast entries, one per product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission.",
        "children": [
          {
            "name": "productId",
            "kind": "required",
            "type": "string",
            "description": "Product identifier (maps to primary_product_id). Max 100 characters."
          },
          {
            "name": "facilityId",
            "kind": "required",
            "type": "string",
            "description": "Facility identifier (maps to facility_id). Max 100 characters."
          },
          {
            "name": "quantityUom",
            "kind": "optional",
            "type": "string",
            "description": "Unit of measure, for example \"EA\", \"CS\", \"KG\", \"LB\". Max 10 characters. Stored exactly as sent — no default is applied. Empty string, \"NA\" and \"N/A\" are treated as not supplied."
          },
          {
            "name": "forecastData",
            "kind": "required",
            "type": "object",
            "description": "Forecast points for this product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission; an empty or missing array rejects this entry only.",
            "children": [
              {
                "name": "date",
                "kind": "required",
                "type": "string",
                "description": "Forecast date, YYYY-MM-DD. Must be unique within this forecastData array. A date in any other format causes the entire submission to be discarded."
              },
              {
                "name": "quantity",
                "kind": "required",
                "type": "number",
                "description": "Forecasted supply quantity. Must be ≥ 0."
              }
            ]
          },
          {
            "name": "referenceAttributes",
            "kind": "optional",
            "type": "object",
            "description": "Additional forecast metadata. Stored as submitted and not interpreted."
          }
        ],
        "schema": [
          {
            "name": "productId",
            "kind": "required",
            "type": "string",
            "description": "Product identifier (maps to primary_product_id). Max 100 characters."
          },
          {
            "name": "facilityId",
            "kind": "required",
            "type": "string",
            "description": "Facility identifier (maps to facility_id). Max 100 characters."
          },
          {
            "name": "quantityUom",
            "kind": "optional",
            "type": "string",
            "description": "Unit of measure, for example \"EA\", \"CS\", \"KG\", \"LB\". Max 10 characters. Stored exactly as sent — no default is applied. Empty string, \"NA\" and \"N/A\" are treated as not supplied."
          },
          {
            "name": "forecastData",
            "kind": "required",
            "type": "object",
            "description": "Forecast points for this product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission; an empty or missing array rejects this entry only.",
            "children": [
              {
                "name": "date",
                "kind": "required",
                "type": "string",
                "description": "Forecast date, YYYY-MM-DD. Must be unique within this forecastData array. A date in any other format causes the entire submission to be discarded."
              },
              {
                "name": "quantity",
                "kind": "required",
                "type": "number",
                "description": "Forecasted supply quantity. Must be ≥ 0."
              }
            ]
          },
          {
            "name": "referenceAttributes",
            "kind": "optional",
            "type": "object",
            "description": "Additional forecast metadata. Stored as submitted and not interpreted."
          }
        ]
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "production",
  "legacyHash": "gVz17xGVULXZQYRRGZej3"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Staging",
  "method": "POST",
  "url": "https://api-staging.fourkites.com/api/v1/async/forecast/supply",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "4wgDRM6EKcGac3El9lEBN",
        "language": "curl",
        "code": "curl --location 'https://api-staging.fourkites.com/api/v1/async/forecast/supply' \\\n--header 'Content-Type: application/json' \\\n--header 'apikey: APIKEY' \\\n--data '{\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180.0\n        },\n        {\n          \"date\": \"2024-08-06\", \n          \"quantity\": 150.0\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200.0\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"dataSource\": \"WMS_FORECAST_ENGINE\"\n      }\n    }\n  ]\n}'",
        "customLabel": ""
      },
      {
        "id": "JfkJa4ySt_xGG89YTyvfh",
        "language": "java",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://api-staging.fourkites.com/api/v1/async/forecast/supply\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"apikey\", \"APIKEY\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "customLabel": ""
      },
      {
        "id": "5dC2AAhUvNHoCxposLeKN",
        "language": "javascript",
        "code": "var settings = {\n  \"url\": \"https://api-staging.fourkites.com/api/v1/async/forecast/supply\",\n  \"method\": \"POST\",\n  \"timeout\": 0,\n  \"headers\": {\n    \"Content-Type\": \"application/json\",\n    \"apikey\": \"APIKEY\"\n  },\n  \"data\": JSON.stringify({\n    \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n    \"forecasts\": [\n      {\n        \"productId\": \"WIRE-BEL-COA-001\",\n        \"facilityId\": \"442344\",\n        \"quantityUom\": \"EA\",\n        \"forecastData\": [\n          {\n            \"date\": \"2024-08-05\",\n            \"quantity\": 180\n          },\n          {\n            \"date\": \"2024-08-06\",\n            \"quantity\": 150\n          },\n          {\n            \"date\": \"2024-08-07\",\n            \"quantity\": 200\n          }\n        ],\n        \"referenceAttributes\": {\n          \"forecastModel\": \"ML_TIMESERIES_V3\",\n          \"planningGroup\": \"WIRE_CABLE\",\n          \"seasonalityFactor\": 1.2,\n          \"promotionFlag\": false,\n          \"forecastAccuracy\": 0.87,\n          \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n          \"dataSource\": \"WMS_FORECAST_ENGINE\",\n          \"supplierLeadTime\": 14,\n          \"minimumOrderQuantity\": 500\n        }\n      }\n    ]\n  }),\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});",
        "customLabel": ""
      },
      {
        "id": "T1kLo3ROSupAbVto0dmxO",
        "language": "swift",
        "code": "let parameters = \"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\"\nlet postData = parameters.data(using: .utf8)\n\nvar request = URLRequest(url: URL(string: \"https://api-staging.fourkites.com/api/v1/async/forecast/supply\")!,timeoutInterval: Double.infinity)\nrequest.addValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\nrequest.addValue(\"APIKEY\", forHTTPHeaderField: \"apikey\")\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",
        "customLabel": ""
      },
      {
        "id": "--Up5EjPTotuJnZJ1s2iI",
        "language": "csharp",
        "code": "var client = new HttpClient();\nvar request = new HttpRequestMessage(HttpMethod.Post, \"https://api-staging.fourkites.com/api/v1/async/forecast/supply\");\nrequest.Headers.Add(\"apikey\", \"APIKEY\");\nvar content = new StringContent(\"{\\n  \\\"messageId\\\": \\\"FCT-SUPPLY-2024-07-30-001\\\",\\n  \\\"forecasts\\\": [\\n    {\\n      \\\"productId\\\": \\\"WIRE-BEL-COA-001\\\",\\n      \\\"facilityId\\\": \\\"442344\\\",\\n      \\\"quantityUom\\\": \\\"EA\\\",\\n      \\\"forecastData\\\": [\\n        {\\n          \\\"date\\\": \\\"2024-08-05\\\",\\n          \\\"quantity\\\": 180.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-06\\\", \\n          \\\"quantity\\\": 150.0\\n        },\\n        {\\n          \\\"date\\\": \\\"2024-08-07\\\",\\n          \\\"quantity\\\": 200.0\\n        }\\n      ],\\n      \\\"referenceAttributes\\\": {\\n        \\\"forecastModel\\\": \\\"ML_TIMESERIES_V3\\\",\\n        \\\"planningGroup\\\": \\\"WIRE_CABLE\\\",\\n        \\\"seasonalityFactor\\\": 1.2,\\n        \\\"promotionFlag\\\": false,\\n        \\\"forecastAccuracy\\\": 0.87,\\n        \\\"lastModelUpdate\\\": \\\"2024-07-25T09:00:00Z\\\",\\n        \\\"dataSource\\\": \\\"WMS_FORECAST_ENGINE\\\",\\n        \\\"supplierLeadTime\\\": 14,\\n        \\\"minimumOrderQuantity\\\": 500\\n      }\\n    }\\n  ]\\n}\", null, \"application/json\");\nrequest.Content = content;\nvar response = await client.SendAsync(request);\nresponse.EnsureSuccessStatusCode();\nConsole.WriteLine(await response.Content.ReadAsStringAsync());\n",
        "customLabel": ""
      },
      {
        "id": "zjEKVhh5n1yTKjBDYDrI3",
        "language": "go",
        "code": "package main\n\nimport (\n  \"fmt\"\n  \"strings\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n\n  url := \"https://api-staging.fourkites.com/api/v1/async/forecast/supply\"\n  method := \"POST\"\n\n  payload := strings.NewReader(`{\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180.0\n        },\n        {\n          \"date\": \"2024-08-06\", \n          \"quantity\": 150.0\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200.0\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": false,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n}`)\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, payload)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"Content-Type\", \"application/json\")\n  req.Header.Add(\"apikey\", \"APIKEY\")\n\n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}",
        "customLabel": ""
      },
      {
        "id": "vHjYv1Gp6BXs2_5Gv1syz",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api-staging.fourkites.com/api/v1/async/forecast/supply\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = \"application/json\"\nrequest[\"apikey\"] = \"APIKEY\"\nrequest.body = JSON.dump({\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180\n        },\n        {\n          \"date\": \"2024-08-06\",\n          \"quantity\": 150\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": false,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      },
      {
        "id": "pZu0iFSZ8Jylnllf-wXiP",
        "language": "python",
        "code": "import http.client\nimport json\n\nconn = http.client.HTTPSConnection(\"api-staging.fourkites.com\")\npayload = json.dumps({\n  \"messageId\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"forecasts\": [\n    {\n      \"productId\": \"WIRE-BEL-COA-001\",\n      \"facilityId\": \"442344\",\n      \"quantityUom\": \"EA\",\n      \"forecastData\": [\n        {\n          \"date\": \"2024-08-05\",\n          \"quantity\": 180\n        },\n        {\n          \"date\": \"2024-08-06\",\n          \"quantity\": 150\n        },\n        {\n          \"date\": \"2024-08-07\",\n          \"quantity\": 200\n        }\n      ],\n      \"referenceAttributes\": {\n        \"forecastModel\": \"ML_TIMESERIES_V3\",\n        \"planningGroup\": \"WIRE_CABLE\",\n        \"seasonalityFactor\": 1.2,\n        \"promotionFlag\": False,\n        \"forecastAccuracy\": 0.87,\n        \"lastModelUpdate\": \"2024-07-25T09:00:00Z\",\n        \"dataSource\": \"WMS_FORECAST_ENGINE\",\n        \"supplierLeadTime\": 14,\n        \"minimumOrderQuantity\": 500\n      }\n    }\n  ]\n})\nheaders = {\n  'Content-Type': 'application/json',\n  'apikey': 'APIKEY'\n}\nconn.request(\"POST\", \"/api/v1/async/forecast/supply\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "pZu0iFSZ8Jylnllf-wXiP"
  },
  "results": {
    "languages": [
      {
        "id": "bL0XUOQALkYMh6AagovNz",
        "language": "202",
        "code": "{\n  \"request_id\": \"FCT-SUPPLY-2024-07-30-001\"\n}",
        "customLabel": ""
      },
      {
        "id": "D0wVV0kWLO6749Zmp3uY2",
        "language": "401",
        "code": "{\n  \"error_message\": \"Unauthorized access.\"\n}",
        "customLabel": ""
      },
      {
        "id": "UCXMLh4K5gw5pkGJ39inA",
        "language": "500",
        "code": "{\n  \"request_id\": \"FCT-SUPPLY-2024-07-30-001\",\n  \"error_message\": \"Failed to process supply forecast data.\"\n}",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "bL0XUOQALkYMh6AagovNz"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "name": "message_id",
        "kind": "optional",
        "type": "string",
        "description": "Correlation identifier returned as request_id. Falls back to the body's messageId, then to a generated identifier."
      },
      {
        "name": "company_id",
        "kind": "optional",
        "type": "string",
        "description": "Resolved from your API key when omitted. Most callers should omit it."
      }
    ],
    "headerParameters": [
      {
        "name": "Content-Type",
        "kind": "required",
        "type": "string",
        "description": "application/json"
      },
      {
        "name": "apikey",
        "kind": "required",
        "type": "string",
        "description": "Your API key. Determines the company the forecast is stored against."
      }
    ],
    "bodyDataParameters": [
      {
        "name": "messageId",
        "kind": "optional",
        "type": "string",
        "description": "Message identifier, used as the request_id fallback. Not checked for uniqueness and does not deduplicate submissions."
      },
      {
        "name": "forecasts",
        "kind": "required",
        "type": "object",
        "description": "Forecast entries, one per product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission.",
        "children": [
          {
            "name": "productId",
            "kind": "required",
            "type": "string",
            "description": "Product identifier (maps to primary_product_id). Max 100 characters."
          },
          {
            "name": "facilityId",
            "kind": "required",
            "type": "string",
            "description": "Facility identifier (maps to facility_id). Max 100 characters."
          },
          {
            "name": "quantityUom",
            "kind": "optional",
            "type": "string",
            "description": "Unit of measure, for example \"EA\", \"CS\", \"KG\", \"LB\". Max 10 characters. Stored exactly as sent — no default is applied. Empty string, \"NA\" and \"N/A\" are treated as not supplied."
          },
          {
            "name": "forecastData",
            "kind": "required",
            "type": "object",
            "description": "Forecast points for this product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission; an empty or missing array rejects this entry only.",
            "children": [
              {
                "name": "date",
                "kind": "required",
                "type": "string",
                "description": "Forecast date, YYYY-MM-DD. Must be unique within this forecastData array. A date in any other format causes the entire submission to be discarded."
              },
              {
                "name": "quantity",
                "kind": "required",
                "type": "number",
                "description": "Forecasted supply quantity. Must be ≥ 0."
              }
            ]
          },
          {
            "name": "referenceAttributes",
            "kind": "optional",
            "type": "object",
            "description": "Additional forecast metadata. Stored as submitted and not interpreted."
          }
        ],
        "schema": [
          {
            "name": "productId",
            "kind": "required",
            "type": "string",
            "description": "Product identifier (maps to primary_product_id). Max 100 characters."
          },
          {
            "name": "facilityId",
            "kind": "required",
            "type": "string",
            "description": "Facility identifier (maps to facility_id). Max 100 characters."
          },
          {
            "name": "quantityUom",
            "kind": "optional",
            "type": "string",
            "description": "Unit of measure, for example \"EA\", \"CS\", \"KG\", \"LB\". Max 10 characters. Stored exactly as sent — no default is applied. Empty string, \"NA\" and \"N/A\" are treated as not supplied."
          },
          {
            "name": "forecastData",
            "kind": "required",
            "type": "object",
            "description": "Forecast points for this product-facility combination. At least 1, at most 500. Exceeding 500 discards the whole submission; an empty or missing array rejects this entry only.",
            "children": [
              {
                "name": "date",
                "kind": "required",
                "type": "string",
                "description": "Forecast date, YYYY-MM-DD. Must be unique within this forecastData array. A date in any other format causes the entire submission to be discarded."
              },
              {
                "name": "quantity",
                "kind": "required",
                "type": "number",
                "description": "Forecasted supply quantity. Must be ≥ 0."
              }
            ]
          },
          {
            "name": "referenceAttributes",
            "kind": "optional",
            "type": "object",
            "description": "Additional forecast metadata. Stored as submitted and not interpreted."
          }
        ]
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "staging",
  "legacyHash": "hvqWs8nQaqrysPnd-1WZ8"
}
```
:::

There is no 400 response for a malformed forecast on this endpoint. Body-level problems are detected downstream, after the 202 has been returned.
