{
  "openapi": "3.1.0",
  "info": {
    "title": "56Atlas API",
    "version": "0.1.0",
    "description": "Search the annual reports (Form 56-1 One Report) of companies listed on the Stock Exchange of Thailand and cite the pages. Each tool is also available over MCP at https://app.56atlas.com/mcp. Authenticate with a personal API key (fa_…) as a Bearer token. Terms: https://56atlas.com/developers/terms"
  },
  "servers": [
    {
      "url": "https://app.56atlas.com"
    }
  ],
  "paths": {
    "/api/v1/tools/list_companies": {
      "post": {
        "operationId": "restListCompanies",
        "summary": "Find companies by symbol or name, with their searchable report years (free)",
        "description": "The list_companies MCP tool over plain JSON. Counts against the same rate limits. Answers at most 20 companies.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListCompaniesInput"
              }
            }
          }
        },
        "security": [
          {
            "APIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The tool's result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APICompanyList"
                }
              }
            }
          },
          "400": {
            "description": "invalid_arguments when the body does not match the schema exactly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error",
            "description": "Missing or invalid API key, with a WWW-Authenticate challenge. OAuth access tokens are issued for /mcp and are refused here"
          },
          "403": {
            "$ref": "#/components/responses/Error",
            "description": "invalid_origin from a foreign browser origin, insufficient_scope, or account_suspended"
          },
          "404": {
            "description": "public_api_disabled until PUBLIC_API_ENABLED is set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/Error",
            "description": "Request body over 64 KiB"
          },
          "429": {
            "description": "rate_limited when a per-client or per-user limit per UTC minute or day is reached (nothing ran and no quota was used)",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "503": {
            "description": "search_unavailable, busy, rate_limits_unavailable or auth_unavailable; retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/search_evidence": {
      "post": {
        "operationId": "restSearchEvidence",
        "summary": "Search one company's annual reports for reranked, citable passages",
        "description": "The search_evidence MCP tool over plain JSON, with the same evidence, billing (AI_CREDIT_API_CALL credits per successful call, including one with no results), rate limits and coverage limit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchEvidenceInput"
              }
            }
          }
        },
        "security": [
          {
            "APIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The tool's result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceSearch"
                }
              }
            }
          },
          "400": {
            "description": "invalid_arguments when the body does not match the schema exactly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error",
            "description": "Missing or invalid API key, with a WWW-Authenticate challenge. OAuth access tokens are issued for /mcp and are refused here"
          },
          "402": {
            "description": "insufficient_credits; nothing was returned or charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error",
            "description": "invalid_origin from a foreign browser origin, insufficient_scope, or account_suspended"
          },
          "404": {
            "description": "public_api_disabled until PUBLIC_API_ENABLED is set, or company_not_found and report_scope_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/Error",
            "description": "Request body over 64 KiB"
          },
          "429": {
            "description": "rate_limited when a per-client or per-user limit per UTC minute or day is reached (nothing ran and no quota was used), or coverage_limited when the account has been returned PUBLIC_API_COVERAGE_PERCENT of the company's ready pages in 24 hours",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "503": {
            "description": "search_unavailable, busy, rate_limits_unavailable or auth_unavailable; retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/get_page": {
      "post": {
        "operationId": "restGetPage",
        "summary": "Read the full text of a page that search_evidence cited",
        "description": "The get_page MCP tool over plain JSON, with the same billing, rate limits and coverage limit. Only citation IDs issued to the same API key work.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetPageInput"
              }
            }
          }
        },
        "security": [
          {
            "APIKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The tool's result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CitedPage"
                }
              }
            }
          },
          "400": {
            "description": "invalid_arguments when the body does not match the schema exactly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error",
            "description": "Missing or invalid API key, with a WWW-Authenticate challenge. OAuth access tokens are issued for /mcp and are refused here"
          },
          "402": {
            "description": "insufficient_credits; nothing was returned or charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Error",
            "description": "invalid_origin from a foreign browser origin, insufficient_scope, or account_suspended"
          },
          "404": {
            "description": "public_api_disabled until PUBLIC_API_ENABLED is set, or citation_not_found (also for a malformed citation_id)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/Error",
            "description": "Request body over 64 KiB"
          },
          "429": {
            "description": "rate_limited when a per-client or per-user limit per UTC minute or day is reached (nothing ran and no quota was used), or coverage_limited when the account has been returned PUBLIC_API_COVERAGE_PERCENT of the company's ready pages in 24 hours",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          },
          "503": {
            "description": "search_unavailable, busy, rate_limits_unavailable or auth_unavailable; retry later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAPIError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "APICompanyList": {
        "type": "object",
        "required": [
          "companies",
          "truncated"
        ],
        "properties": {
          "companies": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "symbol",
                "name_th",
                "name_en",
                "available_years",
                "query_ready"
              ],
              "properties": {
                "symbol": {
                  "type": "string"
                },
                "name_th": {
                  "type": "string"
                },
                "name_en": {
                  "type": "string"
                },
                "available_years": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                },
                "query_ready": {
                  "type": "boolean"
                }
              }
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "More companies match than were returned"
          }
        }
      },
      "CitedPage": {
        "type": "object",
        "required": [
          "citation_id",
          "citation_url",
          "symbol",
          "year",
          "page",
          "text"
        ],
        "properties": {
          "citation_id": {
            "type": "string"
          },
          "citation_url": {
            "type": "string",
            "format": "uri"
          },
          "symbol": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "page": {
            "type": "integer"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Stable machine-readable error code"
          }
        }
      },
      "EvidenceSearch": {
        "type": "object",
        "required": [
          "symbol",
          "query",
          "searched_years",
          "results"
        ],
        "properties": {
          "symbol": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "searched_years": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "results": {
            "type": "array",
            "description": "Reranked passages above the relevance cutoff; empty when the reports do not clearly answer",
            "items": {
              "type": "object",
              "required": [
                "citation_id",
                "citation_url",
                "symbol",
                "year",
                "page",
                "relevance",
                "snippet"
              ],
              "properties": {
                "citation_id": {
                  "type": "string"
                },
                "citation_url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Cite this link with the company, year and page"
                },
                "symbol": {
                  "type": "string"
                },
                "year": {
                  "type": "integer"
                },
                "page": {
                  "type": "integer"
                },
                "relevance": {
                  "type": "number"
                },
                "snippet": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "GetPageInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "citation_id"
        ],
        "properties": {
          "citation_id": {
            "type": "string",
            "pattern": "^c_[A-Za-z0-9_-]{43}$"
          }
        }
      },
      "ListCompaniesInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 100,
            "description": "Part of a symbol or company name, for example \"PTT\", \"ปตท\" or \"Siam Cement\""
          }
        }
      },
      "PublicAPIError": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "A stable code such as invalid_arguments, insufficient_credits, rate_limited or coverage_limited"
          },
          "message": {
            "type": "string",
            "description": "What to do next"
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "SearchEvidenceInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "symbol",
          "query"
        ],
        "properties": {
          "symbol": {
            "type": "string",
            "pattern": "^[A-Za-z0-9.&-]{1,20}$",
            "description": "SET symbol from list_companies"
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "One specific question in Thai or English"
          },
          "years": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1900,
              "maximum": 2200
            },
            "description": "Report years (Gregorian); omit to search every available year"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 5
          }
        }
      }
    },
    "securitySchemes": {
      "APIKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal API key (fa_…) created by the account owner"
      }
    }
  }
}
