Skip to main content
Servix Iran market data API
Documentation menu

Historical data

Daily prices and historical data API | Servix

Request daily or range-based market data from the Servix API. Learn about optional OHLC, Persian date input, response quality, date limits, and errors.

One-day asset prices, daily OHLC, and Persian dates

GET /api/v1/assets/{assetName}/{date} requires an API key in X-API-Key or Authorization: ApiKey. Each authenticated assets request consumes one quota unit. Keep the key in a server-side secret store; do not put it in a URL or browser code.

Four compatible request modes

The existing Gregorian request remains the default. Omitting both query parameters keeps the exact legacy eight-field response: code, name, slug, labelEn, labelFa, quoteUnit, value, and businessTime.

curl -sS https://servix.cc/api/v1/assets/USD_RLS/2026-04-13 \
  -H "X-API-Key: <your-api-key>"

calendar defaults to gregorian; you may also send calendar=gregorian explicitly. Add include=ohlc to receive the daily extension:

curl -sS "https://servix.cc/api/v1/assets/USD_RLS/2026-04-13?calendar=gregorian&include=ohlc" \
  -H "X-API-Key: <your-api-key>"

For Solar Hijri input, use the same strict YYYY-MM-DD shape and explicitly select calendar=persian. Persian 1405-01-24 and Gregorian 2026-04-13 resolve to the same day:

curl -sS "https://servix.cc/api/v1/assets/USD_RLS/1405-01-24?calendar=persian" \
  -H "X-API-Key: <your-api-key>"
curl -sS "https://servix.cc/api/v1/assets/USD_RLS/1405-01-24?calendar=persian&include=ohlc" \
  -H "X-API-Key: <your-api-key>"

These cURL snippets are server-side examples. Values in angle brackets are placeholders. The date calendar selects how the path is parsed; it does not select a time zone.

Legacy value and daily OHLC

value remains the value selected by the legacy dated lookup. It is not a daily average. With include=ohlc, open, high, low, and close summarize canonical trusted observations after same-time corrections are resolved. close can differ from legacy value because the two selections have different history and correction rules. Price fields are JSON numbers in the asset's quoteUnit (for example, RLS); examples elsewhere use schematic string placeholders and are not valid numeric response bodies.

Daily response fields

FieldMeaning
day.dateResolved Gregorian date, even when the path used a Persian date.
day.timeZoneThe effective database-session time zone used by the legacy date lookup.
day.start, day.endUTC instants for the local day: start is inclusive and end is exclusive at the next local midnight. The elapsed window can differ from 24 hours.
ohlcA daily candle, or null when no trusted observations exist. No zero or forward-filled candle is created.
ohlc.start, ohlc.endThe same inclusive/exclusive full-day UTC boundaries, even when observations cover only part of the day.
ohlc.open, high, low, closeFirst, highest, lowest, and last canonical trusted values in the day.
ohlc.observationCountNumber of timestamps after duplicate corrections are resolved.
ohlc.completeTrue only after the day has elapsed and trusted history starts by day start. It does not prove there were no collection gaps.
ohlcAvailableFromFirst known trusted-history instant for the asset, or null.
ohlcStatusAVAILABLE, PARTIAL, or UNAVAILABLE.

AVAILABLE means a trusted candle exists for an elapsed day whose trusted-history boundary starts no later than day start. PARTIAL means observations exist but the day is still open or trusted history starts during the day. UNAVAILABLE means ohlc is null. A legacy value can still be returned when OHLC is unavailable. The first covered day and the current day can be partial.

This endpoint's daily window follows the same effective database-session time zone as the legacy date lookup. It is not the UTC-aligned bucket contract of /api/v1/assets/{assetCode}/ohlc?interval=1d.

Historical ranges

Use GET /api/v1/assets/{assetName}/history?from=YYYY-MM-DD&to=YYYY-MM-DD or the existing JSON-body POST /api/v1/assets/{assetName} operation with fromDate and toDate. Both range dates are required and remain Gregorian.

curl -sS "https://servix.cc/api/v1/assets/USD_RLS/history?from=2026-04-01&to=2026-04-13" \
  -H "X-API-Key: <your-api-key>"
curl -sS https://servix.cc/api/v1/assets/USD_RLS \
  -X POST \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <your-api-key>" \
  -d '{"fromDate":"2026-04-01","toDate":"2026-04-13"}'

Each request can span at most 31 days; to must not precede from. An invalid range returns HTTP 417 INVALID_DATE_RANGE. The response can be sparse or empty, so do not assume one record per calendar day. Split longer ranges into requests of at most 31 days, merge by asset code and businessTime, cache results, and avoid rapid retries after HTTP 429.

For freshness and supported-asset coverage, consult the supported assets catalog. The data methodology describes units and data-quality limits. See the errors and rate limits guide for error handling.

Date syntax, range, and errors

Use four year digits, two month digits, two day digits, and ASCII hyphens. ASCII, Persian, and Arabic-Indic digits may be mixed. Invalid or impossible Persian dates, including invalid leap-day dates, return HTTP 400 INVALID_PERSIAN_DATE. Persian dates resolving before Gregorian 2000-01-01 or after 2050-12-31 return HTTP 400 PERSIAN_DATE_OUT_OF_RANGE; both limits are inclusive. Gregorian parsing and its existing behavior are unchanged. Blank, repeated, or unsupported calendar values return HTTP 400 UNSUPPORTED_CALENDAR; blank, repeated, comma-separated, or unsupported include values return HTTP 400 UNSUPPORTED_INCLUDE. An invalid Gregorian date retains INVALID_REQUEST_PARAMETER. A supported asset with no record for the requested day returns HTTP 404 ASSET_NOT_FOUND. Authentication, account-access, and quota failures use HTTP 401, 403, and 429 respectively.

See the endpoint reference, the OpenAPI document, and the Postman collection for generated schemas and safe request variants. The separate interval OHLC API keeps its existing UTC-aligned buckets.

Buy and sell prices of the selected observation

Stored observation sides: buyPrice is the dealer buying price (customer sells) and sellPrice is the dealer selling price (customer buys). Each side comes from the same observation as value, quoteUnit and businessTime, and is an exact JSON number or explicit null if not stored. Old observations may have one or both sides missing. No midpoint, previous side, or latest quote is substituted. calendar=persian only converts the path date to the same Gregorian day; include=ohlc adds a midpoint-only candle and does not change the selected observation. GET history and the equivalent POST range return the selected latest observation for each day returned by the existing range query; missing days are not filled. This change does not retrieve or backfill provider history.

Stored-observation example (protected placeholders):

{
  "code": "USD_RLS",
  "name": "USD_RLS",
  "slug": "usd_rls",
  "labelEn": "US Dollar / Iranian Rial",
  "labelFa": "دلار آمریکا / ریال ایران",
  "quoteUnit": "RLS",
  "value": "<protected-market-value>",
  "businessTime": "<source-timestamp>",
  "buyPrice": "<protected-market-value>",
  "sellPrice": "<protected-market-value>"
}

Separate missing-side example (protected placeholders):

{
  "buyPrice": "<protected-market-value>",
  "sellPrice": null
}