Skip to content
Alpha — Headcode is currently in alpha. APIs and data may change without notice.

List all operators

GET
/v1/operators
curl --request GET \
--url https://api.headcode.dev/v1/operators \
--header 'Authorization: Bearer <token>'

Returns a list of all known UK rail operators.

A list of operators.

Media type application/json
Array<object>
object
code
required

Two-character TOC code.

string
name
required

Full operator name.

string
business_code

Internal business code.

string
sector_code

Sector code.

string
Example
[
{
"code": "GR",
"name": "LNER",
"business_code": "123",
"sector_code": "XYZ"
}
]

API key is missing or invalid.

Media type application/problem+json
Unauthorized

Authentication is missing or invalid.

object
type
required

A URI reference that identifies the problem type.

string format: uri-reference
Allowed value: https://docs.headcode.dev/errors/general/unauthorized
title
required

A short, human-readable summary of the problem type.

string
Allowed value: Unauthorized
status
required

The HTTP status code generated by the origin server for this occurrence.

integer
>= 100 <= 599
Allowed value: 401
detail
required

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri-reference
code
required

An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.

string
<= 100 characters
Allowed value: HEADCODE.GENERAL.UNAUTHORIZED
errors

Optional list of explicit details about the problem for an API consumer.

Array<object>

An object to provide explicit details on a problem towards an API consumer.

object
detail
required

A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.

string
<= 4096 characters
pointer

A JSON Pointer to a specific request body property that is the source of error.

string
<= 1024 characters
parameter

The name of the query or path parameter that is the source of error.

string
<= 1024 characters
header

The name of the header that is the source of error.

string
<= 1024 characters
code

A string containing additional provider specific codes to identify the error context.

string
<= 50 characters
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.

Media type application/problem+json
Too Many Requests

The client has sent too many requests in a given amount of time.

object
type
required

A URI reference that identifies the problem type.

string format: uri-reference
Allowed value: https://docs.headcode.dev/errors/general/rate-limited
title
required

A short, human-readable summary of the problem type.

string
Allowed value: Too Many Requests
status
required

The HTTP status code generated by the origin server for this occurrence.

integer
>= 100 <= 599
Allowed value: 429
detail
required

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri-reference
code
required

An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.

string
<= 100 characters
Allowed value: HEADCODE.GENERAL.RATE_LIMITED
errors

Optional list of explicit details about the problem for an API consumer.

Array<object>

An object to provide explicit details on a problem towards an API consumer.

object
detail
required

A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.

string
<= 4096 characters
pointer

A JSON Pointer to a specific request body property that is the source of error.

string
<= 1024 characters
parameter

The name of the query or path parameter that is the source of error.

string
<= 1024 characters
header

The name of the header that is the source of error.

string
<= 1024 characters
code

A string containing additional provider specific codes to identify the error context.

string
<= 50 characters
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.

Media type application/problem+json
Internal Server Error

An internal error occurred.

object
type
required

A URI reference that identifies the problem type.

string format: uri-reference
Allowed value: https://docs.headcode.dev/errors/general/internal-server-error
title
required

A short, human-readable summary of the problem type.

string
Allowed value: Internal Server Error
status
required

The HTTP status code generated by the origin server for this occurrence.

integer
>= 100 <= 599
Allowed value: 500
detail
required

A human-readable explanation specific to this occurrence of the problem.

string
Allowed value: An internal error occurred.
instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri-reference
code
required

An API-specific error code aiding consumers and the provider team understand the error based on the Headcode error taxonomy.

string
<= 100 characters
Allowed value: HEADCODE.GENERAL.INTERNAL_SERVER_ERROR
errors

Optional list of explicit details about the problem for an API consumer.

Array<object>

An object to provide explicit details on a problem towards an API consumer.

object
detail
required

A granular description on the specific error related to a body property, query parameter, path parameter, and/or header.

string
<= 4096 characters
pointer

A JSON Pointer to a specific request body property that is the source of error.

string
<= 1024 characters
parameter

The name of the query or path parameter that is the source of error.

string
<= 1024 characters
header

The name of the header that is the source of error.

string
<= 1024 characters
code

A string containing additional provider specific codes to identify the error context.

string
<= 50 characters
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"
}