{
  "openapi": "3.0.3",
  "info": {
    "title": "APYData API",
    "version": "1.1.0",
    "description": "Daily yields of bank deposits, savings accounts, government bonds and crypto, with a daily history since 2026-03-08.\n\n**Auth**: every request needs a free API key (create a free account at https://apydata.com/cuenta/registro and get it in the panel), sent as `Authorization: Bearer <key>` or `?api_key=<key>`.\n\n**Limits**: 60 requests/min per IP and 500/day per key on the free plan (non-commercial use, see https://apydata.com/terminos). Every response carries `X-Quota-Limit` and `X-Quota-Remaining`.\n\n**Versioning**: within v1, fields are only added, never renamed or removed. Breaking changes go to a new version, announced at least 90 days before v1 is retired.\n\n**Data**: indicative; always check the product conditions with the issuing institution. `freshness` is `stale` when a product has not been confirmed for 3+ days.",
    "contact": {
      "email": "contact@apydata.com",
      "url": "https://apydata.com/api-docs"
    },
    "termsOfService": "https://apydata.com/terminos"
  },
  "servers": [
    {
      "url": "https://apydata.com/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKeyQuery": []
    }
  ],
  "paths": {
    "/products": {
      "get": {
        "summary": "List active products",
        "operationId": "listProducts",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bancos",
                "crypto",
                "plataformas",
                "tradfi",
                "p2p"
              ]
            }
          },
          {
            "name": "subcategory",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "product_type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "e.g. EUR, USD, USDC"
          },
          {
            "name": "currency_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "fiat",
                "stablecoin",
                "crypto"
              ]
            }
          },
          {
            "name": "risk_level",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bajo",
                "medio",
                "alto",
                "n/a"
              ]
            }
          },
          {
            "name": "liquidity",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "guarantee",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "fgd_eu, fgd, government, private, none"
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ISO 3166-1 alpha-2, or `global`"
          },
          {
            "name": "min_apy",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_apy",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring of entity or product name"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "apy:desc"
            },
            "description": "`field:dir`, comma-separated. Fields: apy, score, entity, deposit, updated, liquidity, risk. Default `apy:desc`."
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            },
            "description": "1-100, or 0 for all. Default 25."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr",
                "de"
              ]
            },
            "description": "Language of `notes`. Default `es`."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            },
            "description": "`csv` returns a CSV file instead of JSON."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              },
              "text/csv": {}
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/products/{slug}": {
      "get": {
        "summary": "One product with its full daily history",
        "operationId": "getProduct",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr",
                "de"
              ]
            },
            "description": "Language of `notes`. Default `es`."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            },
            "description": "`csv` returns only the history (date, apy)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "format": "date"
                          },
                          "apy": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              },
              "text/csv": {}
            }
          },
          "404": {
            "description": "Unknown slug, or product no longer tracked (`not_found`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/categories": {
      "get": {
        "summary": "Stats per category and subcategory",
        "operationId": "listCategories",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/countries": {
      "get": {
        "summary": "Active products per issuer country",
        "operationId": "listCountries",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/best": {
      "get": {
        "summary": "Top N products per category by APY",
        "operationId": "bestProducts",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            },
            "description": "Default 5."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr",
                "de"
              ]
            },
            "description": "Language of `notes`. Default `es`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/index": {
      "get": {
        "summary": "APYData Index: daily medians (CC BY 4.0)",
        "operationId": "getIndex",
        "description": "Without `from`/`to`: the latest value of each key. With them: the daily series. Methodology: https://apydata.com/indice",
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ise",
                "depositos_eur",
                "deuda_eur",
                "stablecoins",
                "prima_cripto"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameter (`invalid_parameter`): see `param` and `allowed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: 60 requests/min per IP, or daily quota of the key (`daily_quota_exceeded`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "api_key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "code"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message"
          },
          "code": {
            "type": "string",
            "enum": [
              "missing_api_key",
              "invalid_api_key",
              "invalid_parameter",
              "not_found",
              "method_not_allowed",
              "rate_limited",
              "daily_quota_exceeded",
              "server_error"
            ]
          },
          "param": {
            "type": "string"
          },
          "allowed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "entity": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "subcategory": {
            "type": "string",
            "nullable": true
          },
          "product_type": {
            "type": "string",
            "nullable": true
          },
          "apy": {
            "type": "number",
            "description": "Annual yield in % as published by the source (APY/TAE for deposits, yield to maturity for bonds, variable rate for DeFi)."
          },
          "score": {
            "type": "number",
            "nullable": true
          },
          "currency": {
            "type": "string"
          },
          "currency_type": {
            "type": "string",
            "enum": [
              "fiat",
              "stablecoin",
              "crypto"
            ]
          },
          "risk_level": {
            "type": "string",
            "enum": [
              "bajo",
              "medio",
              "alto",
              "n/a"
            ]
          },
          "liquidity": {
            "type": "string",
            "nullable": true
          },
          "guarantee": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string"
          },
          "min_deposit": {
            "type": "number",
            "nullable": true
          },
          "min_deposit_currency": {
            "type": "string",
            "nullable": true
          },
          "min_deposit_formatted": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string",
            "description": "Official product page"
          },
          "last_updated": {
            "type": "string",
            "description": "v1 legacy: UTC timestamp of the last confirmation day (a Madrid date may show as the previous day 22:00Z). Prefer last_updated_date."
          },
          "last_updated_date": {
            "type": "string",
            "format": "date",
            "description": "Day the rate was last confirmed against its source."
          },
          "days_since_update": {
            "type": "integer"
          },
          "freshness": {
            "type": "string",
            "enum": [
              "fresh",
              "stale"
            ]
          },
          "data_source": {
            "type": "string",
            "description": "Source of the rate (official API, exchange, institution website…)"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Conditions, in the language of ?lang="
          }
        }
      }
    }
  }
}