Contents
Transitland v2 GraphQL API
Available on the following API tiers:
The Transitland GraphQL API provides a flexible interface for querying within and across the many data models of Transitland. This API is based on the GraphQL query language for APIs, first released as open-source by Facebook and now used for a wide range of web services.
GraphQL vs. REST APIs
The flexibility and power of the GraphQL API does come with some trade-offs: Not all queries are necessarily optimized, so may take time and computational resources to complete. Writing certain types of queries may require knowledge of Transitland's internal schemas. For these reasons, we currently only offer access to the GraphQL API under the paid professional plans, so that Interline staff can be available to provide support via email to coach users through the process of writing GraphQL queries.
Transitland v2 REST API is actually powered behind the scenes by the GraphQL API and is designed to produced queries optimized to the GraphQL API and internal data schemas. We suggest users begin with the v2 REST API and advance to the GraphQL if they require more ability to customize a query or to combine multiple queries into a single request.
GraphQL API Endpoint
The Transitland GraphQL API uses the following endpoint:
https://transit.land/api/v2/query
Following the conventions of GraphQL, all queries should be submitted using the POST
method.
Configuring access
You will need to send your API key as part of the request to this endpoint. It can be specified through either the apikey
query parameter or apikey
header value.
Don't have a Transitland v2 API key? Follow these instructions. Note that GraphQL API access requires a paid professional or enterprise plan.
Schema
Following the conventions of GraphQL, the Transitland GraphQL API provides a schema with information about data models, fields, types, and so on. The schema also provides further documentation.
The base schema is defined in the open-source transitland-server project.
To access the schema available through the hosted v2 GraphQL API, point a GraphQL client at the endpoint.