List all operators
const url = 'https://api.headcode.dev/v1/operators';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.headcode.dev/v1/operators \ --header 'Authorization: Bearer <token>'Returns a list of all known UK rail operators.
Authorizations
Section titled “Authorizations ”Responses
Section titled “ Responses ”A list of operators.
object
Two-character TOC code.
Full operator name.
Internal business code.
Sector code.
Example
[ { "code": "GR", "name": "LNER", "business_code": "123", "sector_code": "XYZ" }]API key is missing or invalid.
Authentication is missing or invalid.
object
A URI reference that identifies the problem type.
A short, human-readable summary of the problem type.
The HTTP status code generated by the origin server for this occurrence.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem.
An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.
Optional list of explicit details about the problem for an API consumer.
An object to provide explicit details on a problem towards an API consumer.
object
A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.
A JSON Pointer to a specific request body property that is the source of error.
The name of the query or path parameter that is the source of error.
The name of the header that is the source of error.
A string containing additional provider specific codes to identify the error context.
Example
{ "type": "https://docs.headcode.dev/errors/general/unauthorized", "title": "Unauthorized", "status": 401, "detail": "missing or malformed Bearer token", "code": "HEADCODE.GENERAL.UNAUTHORIZED"}The client has exceeded its rate limit.
The client has sent too many requests in a given amount of time.
object
A URI reference that identifies the problem type.
A short, human-readable summary of the problem type.
The HTTP status code generated by the origin server for this occurrence.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem.
An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.
Optional list of explicit details about the problem for an API consumer.
An object to provide explicit details on a problem towards an API consumer.
object
A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.
A JSON Pointer to a specific request body property that is the source of error.
The name of the query or path parameter that is the source of error.
The name of the header that is the source of error.
A string containing additional provider specific codes to identify the error context.
Example
{ "type": "https://docs.headcode.dev/errors/general/rate-limited", "title": "Too Many Requests", "status": 429, "detail": "Rate limit exceeded. Please retry after 30 seconds.", "code": "HEADCODE.GENERAL.RATE_LIMITED"}An unexpected internal error occurred.
An internal error occurred.
object
A URI reference that identifies the problem type.
A short, human-readable summary of the problem type.
The HTTP status code generated by the origin server for this occurrence.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem.
An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.
Optional list of explicit details about the problem for an API consumer.
An object to provide explicit details on a problem towards an API consumer.
object
A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.
A JSON Pointer to a specific request body property that is the source of error.
The name of the query or path parameter that is the source of error.
The name of the header that is the source of error.
A string containing additional provider specific codes to identify the error context.
Example
{ "type": "https://docs.headcode.dev/errors/general/internal-server-error", "title": "Internal Server Error", "status": 500, "detail": "An internal error occurred.", "code": "HEADCODE.GENERAL.INTERNAL_SERVER_ERROR"}