{
  "openapi": "3.0.1",
  "info": {
    "title": "AlyawmGold Public API",
    "description": "Open gold and silver spot references, supported markets, and USD history. No registration, API key, or custom header is required. Developer guide: /developers. Public data endpoints share 120 requests per minute per caller IP per application instance. Prices are indicative references, not dealer quotes.",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://alyawmgold.com/"
    }
  ],
  "paths": {
    "/api/v1/history": {
      "get": {
        "tags": [
          "Historical prices"
        ],
        "summary": "Get historical metal prices",
        "description": "Returns XAU or XAG period minimum, average, and maximum values in USD per troy ounce.",
        "parameters": [
          {
            "name": "metal",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "XAU"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "daily"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "default": null
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "default": null
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 365
            }
          }
        ],
        "responses": {
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          }
        }
      }
    },
    "/api/v1/markets": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "List supported markets",
        "description": "Returns active AlyawmGold API V1 countries, currencies, exchange-rate metadata, and website links.",
        "responses": {
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiMarketsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/spot/latest": {
      "get": {
        "tags": [
          "Spot prices"
        ],
        "summary": "Get latest converted spot references",
        "description": "Returns international gold and silver spot references converted into a supported market currency, plus an indicative local gold estimate when the selected market has calibration data. The estimate is not a shop quote.",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "AE"
            }
          }
        ],
        "responses": {
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiLatestSpotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": { }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PublicApiCountry": {
        "required": [
          "code",
          "nameEn",
          "nameAr",
          "currency",
          "currencySymbol",
          "flagEmoji",
          "currencyDecimalPlaces",
          "currencyUnitsPerUsd",
          "exchangeRateUpdatedAtUtc",
          "exchangeRateSource",
          "isUsdPegged",
          "isExchangeRateStale",
          "websiteUrl"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "nameEn": {
            "type": "string"
          },
          "nameAr": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "currencySymbol": {
            "type": "string"
          },
          "flagEmoji": {
            "type": "string"
          },
          "currencyDecimalPlaces": {
            "type": "integer",
            "format": "int32"
          },
          "currencyUnitsPerUsd": {
            "type": "number",
            "format": "double"
          },
          "exchangeRateUpdatedAtUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "exchangeRateSource": {
            "type": "string",
            "nullable": true
          },
          "isUsdPegged": {
            "type": "boolean"
          },
          "isExchangeRateStale": {
            "type": "boolean"
          },
          "websiteUrl": {
            "type": "string"
          }
        }
      },
      "PublicApiDailyChange": {
        "required": [
          "isAvailable",
          "valuePerTroyOunce",
          "percent",
          "baselineRecordedAtUtc"
        ],
        "type": "object",
        "properties": {
          "isAvailable": {
            "type": "boolean"
          },
          "valuePerTroyOunce": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "percent": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "baselineRecordedAtUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PublicApiGoldKarats": {
        "required": [
          "karat24",
          "karat22",
          "karat21",
          "karat18",
          "karat14"
        ],
        "type": "object",
        "properties": {
          "karat24": {
            "type": "number",
            "format": "double"
          },
          "karat22": {
            "type": "number",
            "format": "double"
          },
          "karat21": {
            "type": "number",
            "format": "double"
          },
          "karat18": {
            "type": "number",
            "format": "double"
          },
          "karat14": {
            "type": "number",
            "format": "double"
          }
        },
        "nullable": true
      },
      "PublicApiHistoryPoint": {
        "required": [
          "date",
          "minimum",
          "average",
          "maximum",
          "isCalculatedFallback",
          "isMarketClosed"
        ],
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "minimum": {
            "type": "number",
            "format": "double"
          },
          "average": {
            "type": "number",
            "format": "double"
          },
          "maximum": {
            "type": "number",
            "format": "double"
          },
          "isCalculatedFallback": {
            "type": "boolean"
          },
          "isMarketClosed": {
            "type": "boolean"
          }
        }
      },
      "PublicApiHistoryResponse": {
        "required": [
          "apiVersion",
          "priceType",
          "generatedAtUtc",
          "symbol",
          "metal",
          "currency",
          "unit",
          "interval",
          "requestedFrom",
          "requestedTo",
          "limit",
          "isTruncated",
          "count",
          "data",
          "disclaimerUrl"
        ],
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "priceType": {
            "type": "string"
          },
          "generatedAtUtc": {
            "type": "string",
            "format": "date-time"
          },
          "symbol": {
            "type": "string"
          },
          "metal": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "interval": {
            "type": "string"
          },
          "requestedFrom": {
            "type": "string",
            "nullable": true
          },
          "requestedTo": {
            "type": "string",
            "nullable": true
          },
          "limit": {
            "type": "integer",
            "format": "int32"
          },
          "isTruncated": {
            "type": "boolean"
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiHistoryPoint"
            }
          },
          "disclaimerUrl": {
            "type": "string"
          }
        }
      },
      "PublicApiLatestSpotResponse": {
        "required": [
          "apiVersion",
          "priceType",
          "generatedAtUtc",
          "isMarketOpen",
          "country",
          "metals",
          "disclaimerUrl"
        ],
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "priceType": {
            "type": "string"
          },
          "generatedAtUtc": {
            "type": "string",
            "format": "date-time"
          },
          "isMarketOpen": {
            "type": "boolean"
          },
          "country": {
            "$ref": "#/components/schemas/PublicApiCountry"
          },
          "metals": {
            "$ref": "#/components/schemas/PublicApiSpotMetals"
          },
          "disclaimerUrl": {
            "type": "string"
          },
          "localGoldEstimate": {
            "$ref": "#/components/schemas/PublicApiLocalGoldEstimate"
          }
        }
      },
      "PublicApiLocalGoldEstimate": {
        "required": [
          "karat24",
          "karat22",
          "karat21",
          "karat18",
          "karat14",
          "ounce",
          "tola",
          "kilo"
        ],
        "type": "object",
        "properties": {
          "karat24": {
            "type": "number",
            "format": "double"
          },
          "karat22": {
            "type": "number",
            "format": "double"
          },
          "karat21": {
            "type": "number",
            "format": "double"
          },
          "karat18": {
            "type": "number",
            "format": "double"
          },
          "karat14": {
            "type": "number",
            "format": "double"
          },
          "ounce": {
            "type": "number",
            "format": "double"
          },
          "tola": {
            "type": "number",
            "format": "double"
          },
          "kilo": {
            "type": "number",
            "format": "double"
          }
        },
        "default": null,
        "nullable": true
      },
      "PublicApiMarket": {
        "required": [
          "code",
          "nameEn",
          "nameAr",
          "currency",
          "currencySymbol",
          "flagEmoji",
          "currencyDecimalPlaces",
          "isUsdPegged",
          "currencyUnitsPerUsd",
          "exchangeRateUpdatedAtUtc",
          "exchangeRateSource",
          "isExchangeRateStale",
          "websiteUrl"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "nameEn": {
            "type": "string"
          },
          "nameAr": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "currencySymbol": {
            "type": "string"
          },
          "flagEmoji": {
            "type": "string"
          },
          "currencyDecimalPlaces": {
            "type": "integer",
            "format": "int32"
          },
          "isUsdPegged": {
            "type": "boolean"
          },
          "currencyUnitsPerUsd": {
            "type": "number",
            "format": "double"
          },
          "exchangeRateUpdatedAtUtc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "exchangeRateSource": {
            "type": "string",
            "nullable": true
          },
          "isExchangeRateStale": {
            "type": "boolean"
          },
          "websiteUrl": {
            "type": "string"
          }
        }
      },
      "PublicApiMarketsResponse": {
        "required": [
          "apiVersion",
          "generatedAtUtc",
          "markets",
          "disclaimerUrl"
        ],
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "generatedAtUtc": {
            "type": "string",
            "format": "date-time"
          },
          "markets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiMarket"
            }
          },
          "disclaimerUrl": {
            "type": "string"
          }
        }
      },
      "PublicApiMetalSpot": {
        "required": [
          "symbol",
          "name",
          "currency",
          "quoteRecordedAtUtc",
          "isQuoteStale",
          "units",
          "karats",
          "dailyChange"
        ],
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "quoteRecordedAtUtc": {
            "type": "string",
            "format": "date-time"
          },
          "isQuoteStale": {
            "type": "boolean"
          },
          "units": {
            "$ref": "#/components/schemas/PublicApiPriceUnits"
          },
          "karats": {
            "$ref": "#/components/schemas/PublicApiGoldKarats"
          },
          "dailyChange": {
            "$ref": "#/components/schemas/PublicApiDailyChange"
          }
        },
        "nullable": true
      },
      "PublicApiPriceUnits": {
        "required": [
          "troyOunce",
          "gram",
          "kilogram",
          "tola"
        ],
        "type": "object",
        "properties": {
          "troyOunce": {
            "type": "number",
            "format": "double"
          },
          "gram": {
            "type": "number",
            "format": "double"
          },
          "kilogram": {
            "type": "number",
            "format": "double"
          },
          "tola": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        }
      },
      "PublicApiSpotMetals": {
        "required": [
          "gold",
          "silver"
        ],
        "type": "object",
        "properties": {
          "gold": {
            "$ref": "#/components/schemas/PublicApiMetalSpot"
          },
          "silver": {
            "$ref": "#/components/schemas/PublicApiMetalSpot"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Historical prices"
    },
    {
      "name": "Markets"
    },
    {
      "name": "Spot prices"
    }
  ]
}