GetPreCost

[POST] .../v1/itemprice/getprecost

Returns item cost. Use this method to calculate preliminary item cost for a company and date before creating documents, analytics or price calculations that depend on historical stock cost. The response returns one ItemPreCost record per requested item; the request supports item_id, firm_id and cost_date filters while item_ids, firm_id and cost_date fields and item selection with a non-zero cost_date is required. The caller must have item price select permission 183; missing body, missing item_ids, missing cost_date, denied access, database errors or cost calculation failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
filters Array of Filter Optional Optional filters by fields available for this API method.

Filterable Fields

Field Type Description
cost_date int Cost date as Unix time in seconds. Required and must be greater than 0.
firm_id int Company ID used for stock cost calculation.
item_id int Item IDs. Required and must contain at least one item ID.

Request Example

{
  "filters": [
    {
      "Field": "item_id",
      "Operator": "In",
      "Value": "24"
    },
    {
      "Field": "firm_id",
      "Operator": "Equal",
      "Value": "1"
    },
    {
      "Field": "cost_date",
      "Operator": "Equal",
      "Value": "1712345600"
    }
  ]
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Array of ItemPreCost Result object.

Response Example

{
  "ok": true,
  "result": [
    {
      "item_id": 24,
      "value": 31500.25,
      "cost_date": 1712345600
    }
  ]
}