---
title: "Historical prices for a specific material."
url: "https://developer.argaam.com/apis/macroeconomic-layer-api-sandbox-v1/versions/e4c9f983-817a-417e-bfa3-115c2b14f8bd/operations/getConsumerGoodsByMaterialIdPricesHistory"
---

> Full API specification: https://developer.argaam.com/apis/macroeconomic-layer-api-sandbox-v1/versions/e4c9f983-817a-417e-bfa3-115c2b14f8bd.md

# Historical prices for a specific material.

`GET` `/api/v1.1/consumer-goods/{materialId}/prices/history`

Operation ID: `getConsumerGoodsByMaterialIdPricesHistory`

Time series for trend analysis. Returns end-of-day archive prices over the requested window. ### Example ``` GET /api/v1.1/consumer-goods/42/prices/history?from=2023-01-01&to=2023-12-31 ```

## Path parameters

- `materialId` (integer, int32, required) - Material ID.

## Query parameters

- `from` (string, optional) - Start date (`yyyy-MM-dd`). Defaults to yesterday.
- `to` (string, optional) - End date (`yyyy-MM-dd`). Defaults to today.

## Responses

- `200` - Material name and a list of date/price observations for the requested window.

## OpenAPI definition

````yaml
openapi: 3.0.1
info:
  title: Macroeconomic Layer API
  version: v1.1
servers:
  - url: https://api-sandbox.argaam.com
    description: Argaam API Gateway (Sandbox)
paths:
  /api/v1.1/consumer-goods/{materialId}/prices/history:
    get:
      tags:
        - ConsumerGoods
      parameters:
        - name: materialId
          in: path
          required: true
          schema:
            type: integer
            format: int32
          description: Material ID.
        - name: from
          in: query
          description: Start date (`yyyy-MM-dd`). Defaults to yesterday.
          schema:
            type: string
          example: 2024-01-01
        - name: to
          in: query
          description: End date (`yyyy-MM-dd`). Defaults to today.
          schema:
            type: string
          example: 2024-03-31
      responses:
        "200":
          description: Material name and a list of date/price observations for the
            requested window.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsumerGoodPriceHistoryResponse"
              example:
                materialID: 11
                materialNameAr: دقيق قمح (1 كجم)
                materialNameEn: Wheat Flour (1 kg)
                prices:
                  - forDate: 2023-01-01
                    price: 3
                  - forDate: 2023-04-01
                    price: 3.1
                  - forDate: 2023-07-01
                    price: 3.2
                  - forDate: 2023-10-01
                    price: 3.25
                  - forDate: 2024-01-01
                    price: 3.25
      summary: Historical prices for a specific material.
      description: "Time series for trend analysis. Returns end-of-day archive\r

        prices over the requested window.\r

        \            \r

        ### Example\r

        ```\r

        GET
        /api/v1.1/consumer-goods/42/prices/history?from=2023-01-01&to=2023-12-31\
        \r

        ```"
      operationId: getConsumerGoodsByMaterialIdPricesHistory
security:
  - ApiKeyAuth: []
components:
  schemas:
    ConsumerGoodPriceHistoryResponse:
      type: object
      properties:
        materialID:
          type: integer
          format: int32
        materialNameAr:
          type: string
          nullable: true
        materialNameEn:
          type: string
          nullable: true
        prices:
          type: array
          items:
            $ref: "#/components/schemas/ConsumerGoodPriceEntry"
          nullable: true
      additionalProperties: false
      description: Price history for a single material.
    ConsumerGoodPriceEntry:
      type: object
      properties:
        forDate:
          type: string
          description: Observation date (`yyyy-MM-dd`).
          nullable: true
        price:
          type: number
          format: double
      additionalProperties: false
      description: A single date-price observation in a history series.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: apikey
````
