Skip to main content
To keep client-side parsing logic consistent across endpoints, all AnySport REST endpoints return the same envelope structure. Whether you’re requesting a list of countries or the details of a single match, the outermost fields are always success / data / meta / traceId — only the business structure inside data varies by endpoint. This means you can build a single unified response-parsing layer on the client, rather than writing separate handling logic for each endpoint.

Success response

The shape of data depends on the endpoint type

  • List endpoints (e.g. /countries, /matches, /players): data is an array, wrapped in an array even when there’s only one result.
  • Detail endpoints (e.g. /matches/{match_id}/situation, /lineups): data is a single object.
For the specific fields contained in a given endpoint’s data, refer to that endpoint’s own documentation page; this page only defines the common structure of the outer envelope.

How pagination fields work

For endpoints that support pagination, meta includes page (the current page number, starting from 1), limit (the maximum number of items per page), and total_pages (the total number of pages, calculated from total and limit). Paging logic is straightforward:
When page exceeds total_pages, data returns an empty array rather than an error, allowing the client to determine whether it has reached the last page.
traceId is a unique trace ID for each request. If you encounter unexpected data or need to contact support, please include the traceId of the request in question — this significantly speeds up troubleshooting.

Error response

When a request fails, success is false, and the business data field is replaced with an error object:
Clients should branch primarily on the HTTP status code + error.code, rather than parsing the text content of error.message — the exact wording of message may change over time, but code remains stable.
For the HTTP status and trigger scenario corresponding to each error code, see Error Codes.