convert

Per-gram gold price by karat purity

Changed on

Per-gram XAU price for karats 24 / 22 / 21 / 20 / 18 / 16 / 14 / 10.

Logic: per_gram_24k = spot_xau_usd_per_oz / GRAMS_PER_TROY_OUNCE * fx_rate; per_gram_Nk = per_gram_24k * N/24.

Historical date support is not implemented; omit the param or use /v1/prices/history + do the math client-side.

get/v1/carat

Request

  • Base URL
    https://api.goldprice.dev
  • URL
    https://api.goldprice.dev/v1/carat
  • Auth
    • none
    • or HTTP bearer
    • or API key in header X-API-Key

Query parameters

currencystring

Quote currency (default USD).

Response

Successful Response

currencystring required
timestampstring required
price_gram_24kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_22kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_21kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_20kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_18kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_16kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_14kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

price_gram_10kstring required

Price value as Decimal (up to 8 decimal places). JSON-serialized as a string by Pydantic to avoid float drift; callers should parse with Decimal(), not float().

Changes

    • breaking

      the response property became optional for the status

    • breaking

      the response property became optional for the status

    • breaking

      the response property became optional for the status

    • breaking

      the response property became optional for the status

    • breaking

      response property message list-of-types was widened by adding types null to media type application/json of response 400

    • breaking

      response property message list-of-types was widened by adding types null to media type application/json of response 401

    • breaking

      response property message list-of-types was widened by adding types null to media type application/json of response 429

    • breaking

      response property message list-of-types was widened by adding types null to media type application/json of response 503

    • warning

      removed the optional property from the response with the status

    • info

      the endpoint scheme security ApiKeyAuth was added to the API

    • info

      the endpoint scheme security BearerAuth was added to the API

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status