Skip to main content

Mapbox Tiling Service

Mapbox Tiling Service (MTS) is a tool for creating vector tilesets. With MTS, you use sets of configuration options (tileset recipes) to transform your geospatial data into vector tiles. The resulting tiles are hosted on Mapbox servers for use in your applications.

On this page you'll find the API documentation for interacting with MTS.

Developer Guides and Examples for Mapbox Tiling Service

For a general overview of MTS, its use cases, developer guides and examples, see the Mapbox Tiling Service documentation.

Besides accessing MTS using the API endpoints described here, you can also prepare and upload data for MTS using the Tilesets CLI, a command-line Python tool. For more information about the Tilesets CLI, see the Tilesets CLI documentation and the Get started with MTS and the Tilesets CLI tutorial.

Create a tileset source

post
https://api.mapbox.com/tilesets/v1/sources/{username}/{id}
tilesets:write

Creates a tileset source. A tileset source is raw geographic data formatted as line-delimited GeoJSON and uploaded to Mapbox.com. (Learn more about how line-delimited GeoJSON is used by MTS in the Tileset sources guide.)

Tileset sources are necessary to use MTS to create a new vector tileset, and they are referenced via a tileset source ID. The same tileset source can be used across multiple tilesets.

A tileset source can be composed of up to 10 source files. Each individual source file must not exceed 20 GB. The maximum combined total size of all files that compose a tileset source is 50 GB. If the total size of all the files that compose a tileset source is greater than 50 GB, MTS will return a response that contains an error property with more details. To add multiple source files to a tileset source, see the Append to an existing tileset source endpoint. To replace a tileset source with new source files, use the Replace a tileset source endpoint.

If you no longer need a tileset source, you should manually delete it after any related tilesets are finished processing using the Delete a tileset source endpoint. The related tilesets will continue working normally.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to create a tileset source.
idstringThe ID for the tileset source to be created. Limited to 32 characters. The only allowed special characters are - and _.

The request body must be line-delimited GeoJSON. For information about how to convert GeoJSON or other data formats to line-delimited GeoJSON, see the Tileset sources troubleshooting guide.

Example request: Create a tileset source

$ curl -X POST "https://api.mapbox.com/tilesets/v1/sources/{username}/hello-world?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-F file=@/Users/username/data/mts/countries.geojson.ld \
--header "Content-Type: multipart/form-data"

Response: Create a tileset source

If the request is successful, the response will contain the following properties:

PropertyTypeDescription
file_sizeintegerThe size in bytes of the individual file you have added to your tileset source.
filesintegerThe total number of files in the tileset source.
idstringThe unique identifier for the tileset source.
source_sizeintegerThe total size in bytes of all the files in the tileset source.

Example response: Create a tileset source

{
"file_size": 10592,
"files": 1,
"id": "mapbox://tileset-source/username/hello-world",
"source_size": 10592
}

Append to an existing tileset source

post
https://api.mapbox.com/tilesets/v1/sources/{username}/{id}
tilesets:write

Appends new source data to a tileset source, or creates a source if it does not exist already. A tileset source is raw geographic data formatted as line-delimited GeoJSON and uploaded to Mapbox.com. (Learn more about how line-delimited GeoJSON is used by MTS in the Tileset sources guide.)

Tileset sources are necessary to use MTS to create a new vector tileset, and they are referenced via a tileset source ID. The same tileset source can be used across multiple tilesets.

A tileset source can be composed of up to 10 source files. Each individual source file must not exceed 20 GB. The maximum combined total size of all files that compose a tileset source is 50 GB. If the total size of all the files that compose a tileset source is greater than 50 GB, MTS will return a response that contains an error property with more details. To add multiple source files to a tileset source, post to this endpoint multiple times. This will append the uploaded files to the tileset source. To replace a tileset source with new source files, use the Replace a tileset source endpoint.

If you no longer need a tileset source, you should manually delete it after any related tilesets are finished processing using the Delete a tileset source endpoint. The related tilesets will continue working normally.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to create a tileset source.
idstringThe ID for the tileset source to be append the new source data.

The request body must be line-delimited GeoJSON. For information about how to convert GeoJSON or other data formats to line-delimited GeoJSON, see the Tileset sources troubleshooting guide.

Example request: Append to an existing tileset source

$ curl -X POST "https://api.mapbox.com/tilesets/v1/sources/{username}/hello-world?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-F file=@/Users/username/data/mts/countries.geojson.ld \
--header "Content-Type: multipart/form-data"

Response: Append to an existing tileset source

If the request is successful, the response will contain the following properties:

PropertyTypeDescription
file_sizeintegerThe size in bytes of the individual file you have added to your tileset source.
filesintegerThe total number of files in the tileset source.
idstringThe unique identifier for the tileset source.
source_sizeintegerThe total size in bytes of all the files in the tileset source.

Example response: Append to an existing tileset source

{
"file_size": 10592,
"files": 2,
"id": "mapbox://tileset-source/username/hello-world",
"source_size": 20884
}

Replace a tileset source

put
https://api.mapbox.com/tilesets/v1/sources/{username}/{id}
tilesets:write

Replaces a tileset source with new source data, or creates a source if it does not exist already. If the total size of the uploaded file is greater than 20 GB, MTS will return a response that contains an error property with more details.

If you no longer need a tileset source, you should manually delete it after any related tilesets are finished processing using the Delete a tileset source endpoint. The related tilesets will continue working normally.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to create a tileset source.
idstringThe ID for the tileset source to be replaced.

The request body must be line-delimited GeoJSON. For information about how to convert GeoJSON or other data formats to line-delimited GeoJSON, see the Tileset sources troubleshooting guide.

Example request: Replace a tileset source

$ curl -X PUT "https://api.mapbox.com/tilesets/v1/sources/{username}/hello-world?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-F file=@/Users/username/data/mts/countries.geojson.ld \
--header "Content-Type: multipart/form-data"

Response: Replace a tileset source

If the request is successful, the response will contain the following properties:

PropertyTypeDescription
file_sizeintegerThe size in bytes of the individual file you have added to your tileset source.
filesintegerThe total number of files in the tileset source.
idstringThe unique identifier for the tileset source.
source_sizeintegerThe total size in bytes of all the files in the tileset source.

Example response: Replace a tileset source

{
"file_size": 10592,
"files": 1,
"id": "mapbox://tileset-source/username/hello-world",
"source_size": 10592
}

Retrieve tileset source information

get
https://api.mapbox.com/tilesets/v1/sources/{username}/{id}
tilesets:read

Get information for a specific tileset source, including the number and total size of the files in the tileset source.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to retrieve tileset source information.
idstringThe ID for the tileset source to be retrieved.

Example request: Retrieve tileset source information

$ curl "https://api.mapbox.com/tilesets/v1/sources/{username}/hello-world?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Retrieve tileset source information

If the request is successful, the response will contain the following properties:

PropertyTypeDescription
filesintegerThe total number of files in the tileset source.
idstringThe unique identifier for the tileset source.
sizeintegerThe total size in bytes of all files in the tileset source.
size_nicestringThe total size of all files in the tileset source, in a human-readable format.

Example response: Retrieve tileset source information

{
"files": 2,
"id": "mapbox://tileset-source/username/hello-world",
"size": 20884,
"size_nice": "20.39KB"
}

List tileset sources

get
https://api.mapbox.com/tilesets/v1/sources/{username}
tilesets:list

List all the tileset sources that belong to an account. This endpoint supports pagination.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to retrieve tileset source information.

You can further refine the results from this endpoint with the following optional parameters:

Optional parametersTypeDescription
sortbystringSort the listings by their created or modified timestamps.
limitintegerThe maximum number of tileset sources to return, from 1 to 500. The default is 100.
startstringThe tileset after which to start the listing. Find the key in the Link header of a response. See the pagination section for details.

Example request: List tileset sources

$ curl "https://api.mapbox.com/tilesets/v1/sources/{username}?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: List tileset sources

If the request is successful, the response will be a list of the tileset sources that belong to the specified account. Each individual source in the list will contain the following properties:

PropertyTypeDescription
filesintegerThe total number of files in the tileset source.
idstringThe unique identifier for the tileset source.
sizeintegerThe total size in bytes of all files in the tileset source.

If the account has more than 2000 tileset sources, the response list will be capped at 2000.

Example response: List tileset sources

[
{
"files": 2,
"id": "mapbox://tileset-source/username/hello-world",
"size": 20884
},
{
"files": 3,
"id": "mapbox://tileset-source/username/hola-mundo",
"size": 650332
}
]

Delete a tileset source

delete
https://api.mapbox.com/tilesets/v1/sources/{username}/{id}
tilesets:write

Permanently delete a tileset source and all its files. This is not a recoverable action.

Don't delete a tileset source while it's in use

If you delete a tileset source, any in-progress jobs that use that tileset source will fail.

Required parametersTypeDescription
usernamestringThe Mapbox username of the account for which to delete a tileset source.
idstringThe ID for the tileset source to be deleted.

Example request: Delete a tileset source

$ curl -X DELETE "https://api.mapbox.com/tilesets/v1/sources/{username}/hello-world?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Delete a tileset source

If the tileset source is successfully deleted, the response will be HTTP 204 No Content.

Create a tileset

post
https://api.mapbox.com/tilesets/v1/{tileset_id}
tilesets:write
Prerequisites for creating a new tileset

Before you can create a new tileset, you need to create a tileset source and write a tileset recipe. The tileset recipe defines how to transform the data in the tileset source into vector tiles.

Create a new tileset.

Required parametersTypeDescription
tileset_idstringThe ID for the tileset to be created, which is composed of your username followed by a period and the tileset's unique name (username.id). Limited to 32 characters. This character limit does not include your username. The only allowed special characters are - and _.

The request body must be a JSON object that contains the following properties:

Required request body propertyTypeDescription
recipeobjectA recipe that describes how the GeoJSON data you uploaded should be transformed into tiles. For more information on how to create and format recipes, see the Recipe reference and Recipe examples.
namestringThe name of the tileset. Limited to 64 characters.

Additionally, the request body may contain the following optional properties:

Optional request body propertiesTypeDescription
privatebooleanDescribes whether the tileset must be used with an access token from your Mapbox account. Default is true.
descriptionstringA description of the tileset. Limited to 500 characters.
attributionarray of objectsAn array of attribution objects, each with text and link keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values.
attribution.textstringThe attribution text for the tileset.
attribution.linkstringThe URL used for the tileset's attribution.

Example request: Create a tileset

$ curl -X POST "https://api.mapbox.com/tilesets/v1/{tileset_id}?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-d @tileset-information-and-recipe.json \
--header "Content-Type:application/json"

Example request body: Create a tileset

{
"recipe": {
"version": 1,
"layers": {
"hello_world": {
"source": "mapbox://tileset-source/username/hello-world",
"minzoom": 0,
"maxzoom": 5
}
}
},
"name": "Hello World",
"description": "Spaceship Earth with all of the people, places, and things.",
"attribution": [{ "text": "© Hello Legal World", "link": "" }]
}

Response: Create a tileset

{
"message": "Successfully created empty tileset <tileset>. Publish your tileset to begin processing your data into vector tiles."
}

If a tileset with the specified ID already exists, MTS will return an HTTP 400 status code.

Update a tileset

You can update an existing tileset's source, recipe, metadata, and tiles using MTS:

  • Update a tileset's source using the Update a tileset’s recipe endpoint. You can reference a new tileset source in the updated tileset recipe.
  • Update a tileset’s recipe using the Update a tileset’s recipe endpoint. The updated recipe can specify a new minzoom, maxzoom, and more following the rules in the MTS recipe specification.
  • Update a tileset's metadata using the Update tileset information MTS endpoint. You can update a tileset's name, description, private or public state, and attribution information.
  • Update a tileset’s tiles using the Publish a tileset MTS endpoint. The steps to do so are outlined in the Update a tileset with MTS guide. This process can be repeated indefinitely for the same tileset when your source data updates or your recipe requires changes.

Publish a tileset

post
https://api.mapbox.com/tilesets/v1/{tileset_id}/publish
tilesets:write

Once you’ve created a tileset, you can request that the data be "published" into vector tiles. This action will start an asynchronous process known as a job that retrieves your data and processes it into vector tiles according to the recipe you have defined.

This endpoint can also be used to update an existing tileset. Note that due to tile caching, when updating an existing tileset new tiles will only become visible as the cached versions of those tiles expire.

A given tileset can only have one active processing publish job at a time. This ensures the data you have staged is processed before any future data you have staged is processed. If your tileset has an active publish request being processed, all later publish requests will be queued to run in the order they were received. You can only have five jobs in the queue per account.

All jobs are entered into a global Mapbox queue. The larger the queue, the longer it will take your tileset to process. For instructions on how to see the size of the queue, see the View the global queue section.

The size of a single vector tile is limited to 500 KB. If a job drops features due to tile size, this will be noted in the warnings field of the job object.

Required parametersTypeDescription
tileset_idstringThe ID of the tileset to be published, which is composed of your username followed by a period and the tileset's unique name (username.id).

Processing time

There are many factors that can influence the processing time when you publish a tileset, including:

  • The size of the geographical area represented by the data that is being processed. For example, data for a city block will be processed much faster than data for the entire earth.
  • The maximum zoom level applied to each layer. The higher the maximum zoom level, the more tiles that need to be created. Each additional zoom level creates four times as many tiles as the previous zoom level did. As an example, a maximum zoom level of 1 produces four tiles, while a maximum zoom level of 2 produces 16 tiles.
  • The complexity of the tileset recipe, in particular filters, attributes, and union configurations will likely add to the processing time.
  • The size of the global queue, which you can check with the View the global queue endpoint. MTS global queue indicates the number of tileset jobs waiting to be processed.

Example request: Publish a tileset

$ curl -X POST "https://api.mapbox.com/tilesets/v1/{tileset_id}/publish?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Publish a tileset

{
"message": "Processing <tileset>",
"jobId": "<job_id>"
}

If your recipe references a non-existent tileset source, MTS will return an HTTP 400 status code.

Update tileset information

patch
https://api.mapbox.com/tilesets/v1/{tileset_id}
tilesets:write

Update a tileset's information such as name, description, and privacy settings. This is not the endpoint for updating a tileset's recipe, sources, or tiles.

Optional request body propertiesTypeDescription
namestringThe name of the tileset. Limited to 64 characters.
descriptionstringA description of the tileset. Limited to 500 characters.
privatebooleanDescribes whether the tileset must be used with an access token from your Mapbox account.
attributionarray of objectsAn array of attribution objects, each with text and link keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values. For more details on how attribution is displayed when multiple tilesets with custom attribution are composited together, see the attribution display section.
attribution.textstringThe attribution text for the tileset.
attribution.linkstringThe URL used for the tileset's attribution.

Attribution display with multiple tilesets

Custom map attribution strings are composited in reverse order of the composite request and are separated by a space character. For example, the following request to mapbox.mapbox-streets-v8,example.custom-tileset (in which the first tileset is a Mapbox tileset and the second tileset is a custom tileset) will show attribution that looks like:

© Example Maps 2020 © Mapbox © OpenStreetMap

Example request: Update a tileset

$ curl -X PATCH "https://api.mapbox.com/tilesets/v1/{tileset_id}?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
--data '{"name":"New name same me","attribution":[{"text":"New data license","link":"https://example.com"}]}' \
--header "Content-Type:application/json"

Response: Update a tileset

HTTP 204 No Content

Retrieve information about a single tileset job

get
https://api.mapbox.com/tilesets/v1/{tileset_id}/jobs/{job_id}
tilesets:read

Retrieve information about a single job associated with a tileset, based on its unique job ID.

Required parametersTypeDescription
tileset_idstringThe ID for the tileset for which to retrieve information, which is composed of your username followed by a period and the tileset's unique name (username.id).
job_idstringThe publish job's unique identifier. This identifier is returned in the jobId field of a Publish a tileset response.

Example request: Retrieve information about a single tileset job

$ curl "https://api.mapbox.com/tilesets/v1/{tileset_id}/jobs/{job_id}?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Retrieve information about a single tileset job

A successful request will return a JSON response that contains the following properties:

PropertyTypeDescription
idstringThe publish job's unique identifier.
stagestringThe status of the job. Possible values are queued, processing, success, failed, or superseded. The superseded stage is reserved for queued jobs that are replaced, for a newer job on that tileset to process without waiting for old queued job to finish.
createdintegerTimestamp indicating when the job was created.
created_nicestringHuman-readable timestamp indicating when the job was created.
publishedintegerTimestamp indicating when the job was published.
tilesetIdstringThe specified tileset's unique identifier.
errorsarrayThe errors related to the tileset, if relevant. If there are no errors, this will be an empty array. For more information, see our MTS errors documentation.
warningsarrayAny warnings related to the tileset, if relevant. If there are no warnings, this will be an empty array. For more information about warnings, see our MTS warnings documentation.
recipeobjectThe MTS recipe that was used to publish the job.
tileset_precisionsobjectAn object listing the Tileset Processing billing tiers that were used by one or more layers in the job's recipe and the number of square kilometers that were processed in each tier.
layer_statsobjectAn object that contains statistics about the given layer:
layer_stats.total_tilesintegerThe total number of tiles in the tileset that contain this layer.
layer_stats.point_countintegerThe total number of point features for the layer, multiplied by the number of tiles there are in the tileset.
layer_stats.linestring_countintegerThe total number of linestring features for the layer, multiplied by the number of tiles there are in the tileset.
layer_stats.polygon_countintegerThe total number of polygon features for the layer, multiplied by the number of tiles there are in the tileset.
layer_stats.cappedintegerThe number of tiles in which features were no longer added to the layer during tiling due to the size of the layer.
layer_stats.maxzoomintegerThe maximum zoom level of the layer.
layer_stats.minzoomintegerThe minimum zoom level of the layer.
layer_stats.checksumstring A checksum of the geometry and attributes of the features in the layer, including the order of the features but not including their IDs. If two checksums are the same, the tiles from the two tiling jobs are almost certainly identical, but identical recipes and sources are not strictly guaranteed to produce identical checksums.
layer_stats.zoomsobjectAn object that contains statistics for each zoom level in the layer:
layer_stats.zooms.yminintegerThe minimum y tile coordinate at the zoom level.
layer_stats.zooms.ymaxintegerThe maximum y tile coordinate at the zoom level.
layer_stats.zooms.xminintegerThe minimum x tile coordinate at the zoom level.
layer_stats.zooms.xmaxintegerThe maximum x tile coordinate at the zoom level.
layer_stats.zooms.tilesintegerThe total number of tiles at this zoom level for the layer.
layer_stats.zooms.cappedintegerThe number of tiles in which features were no longer added during tiling due to the size of the layer at this zoom level.
layer_stats.zooms.capped_listarray of objectsA list of tiles in this zoom level that exceeded the layer_size. The list may be truncated if large numbers of tiles exceeded the limit. Each element in the capped_list is an object containing a tile (referred to by its zoom/x/y coordinates) and the layer_size that would have been required for that tile to have avoided being capped (or "more than maximum" if the required size exceeds system limits).
layer_stats.zooms.sum_areanumberThe total area that tiles cover at this zoom level for the layer.
layer_stats.zooms.sum_sizeintegerThe total size in bytes of all tiles for this layer at this zoom level, uncompressed.
layer_stats.zooms.avg_sizenumberThe average size of a tile for this layer at this zoom level, uncompressed.
layer_stats.zooms.max_sizeintegerThe maximum size of a tile at this zoom level for this layer.
layer_stats.zooms.size_histogramarray An array of 20 counts of tiles that shows the distribution of tile layer sizes. The first count is the number of tiles between 1 byte and 25 kilobytes, with each subsequent count representing another 25 kilobyte range, up to 500 kilobytes. Any tile layers larger than 500 kilobytes are also included in the last count.

Example response: Retrieve information about a single tileset job

{
"id": "unique_hash",
"stage": "success",
"created": 1560981902377,
"created_nice": "Wed Jun 19 2019 22:05:02 GMT+0000 (UTC)",
"published": 1560982158721,
"tilesetId": "user.id",
"errors": [],
"warnings": [],
"tileset_precisions": { "1m": 658731.7540137176 },
"layer_stats": {
"sample_pois": {
"total_tiles": 71,
"linestring_count": 0,
"capped": 15,
"maxzoom": 12,
"zooms": {
"0": {
"ymin": 0,
"ymax": 0,
"xmin": 0,
"xmax": 0,
"tiles": 1,
"capped": 1,
"capped_list": [{ "layer_size": 1337, "tile": "0/0/0" }],
"sum_size": 512036,
"sum_area": 508164394.24620897,
"avg_size": 512036,
"max_size": 512036,
"size_histogram": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
]
}
}
}
},
"recipe": {
"version": 1,
"layers": {
"sample_pois": {
"minzoom": 1,
"maxzoom": 12,
"source": "mapbox://tileset-source/user/source"
}
}
}
}

List information about all jobs for a tileset

get
https://api.mapbox.com/tilesets/v1/{tileset_id}/jobs
tilesets:list

List information about all jobs associated with a tileset. You can also use this endpoint to query jobs at a specific processing stage: processing, queued, success, failed, or superseded. This endpoint supports pagination.

Required parameterTypeDescription
tileset_idstringThe ID for the tileset for which to list all jobs, which is composed of your username followed by a period and the tileset's unique name (username.id).

You can further refine the results from this endpoint with the following optional parameters:

Optional parameterTypeDescription
stagestringQuery for jobs at a specific processing stage: processing, queued, success, failed, or superseded.
limitintegerThe maximum number of tilesets to return, from 1 to 500. The default is 100.
startstringThe tileset after which to start the listing. Find the key in the Link header of a response. See the pagination section for details.

Example request: List information about all jobs for a tileset

# Request all associated jobs
$ curl "https://api.mapbox.com/tilesets/v1/{tileset_id}/jobs?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

# Request only associated jobs at the success stage
$ curl "https://api.mapbox.com/tilesets/v1/{tileset_id}/jobs?stage=success&access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: List information about all jobs for a tileset

A successful request returns one or more JSON objects that describe a tileset's jobs. Each object will contain the following properties:

PropertyTypeDescription
idstringThe publish job's unique identifier.
stagestringThe status of the job. Possible values are queued, processing, success, failed, or superseded.
createdintegerTimestamp indicating when the job was created.
created_nicestringHuman-readable timestamp indicating when the job was created.
publishedintegerTimestamp indicating when the job was published.
tilesetIdstringThe specified tileset's unique identifier.
errorsarrayThe errors related to the tileset, if relevant. If there are no errors, this will be an empty array. For more information, see our MTS errors documentation.
warningsarrayAny warnings related to the tileset, if relevant. If there are no warnings, this will be an empty array. For more information about warnings, see our MTS warnings documentation.
recipeobjectThe MTS recipe that was used to publish the job.
tileset_precisionsobjectLists the Tileset Processing billing tiers that were used by one or more layers in the job's recipe and the number of square kilometers that were processed in each tier.

Example response: List information about all jobs for a tileset

[
{
"id": "job_1_id",
"stage": "success",
"created": 1560981902377,
"created_nice": "Wed Jun 19 2019 22:05:02 GMT+0000 (UTC)",
"published": 1560982158721,
"tilesetId": "user.id",
"errors": [],
"warnings": [],
"tileset_precisions": { "1m": 658731.7540137176 },
"recipe": {
"version": 1,
"layers": {
"sample_pois": {
"minzoom": 1,
"maxzoom": 12,
"source": "mapbox://tileset-source/user/source"
}
}
}
},
{
"id": "job_2_id",
"stage": "processing",
"created": 1560982159327,
"created_nice": "Wed Jun 19 2019 22:09:19 GMT+0000 (UTC)",
"published": 1560985238565,
"tilesetId": "user.id",
"errors": [],
"warnings": [],
"recipe": {
"version": 1,
"layers": {
"sample_pois": {
"minzoom": 1,
"maxzoom": 12,
"source": "mapbox://tileset-source/user/revised-source"
}
}
}
}
]

View the global queue

put
https://api.mapbox.com/tilesets/v1/queue
tilesets:read

View the number of queued jobs in the global queue, which shows the number of jobs waiting to be processed.

Example request: View the global queue

$ curl -X PUT "https://api.mapbox.com/tilesets/v1/queue?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: View the global queue

A request to this endpoint returns the number of jobs waiting to be processed in the global MTS queue.

PropertyTypeDescription
totalintegerThe number of queued jobs.

Example response: View the global queue

{
"total": 42
}

Validate a recipe

put
https://api.mapbox.com/tilesets/v1/validateRecipe
tilesets:write

Validate a recipe document before using it to create a new tileset. The entire request body must be the recipe JSON document, which is the recipe part of the request body property of a tileset creation request. For guidance on how to format a recipe, see the Recipe reference.

You can control the behavior of this endpoint with the following optional parameter:

Optional parametersTypeDescription
accept_invalid_sourcesbooleanIf true, do not validate the source URL for each layer. This allows you to validate the syntax of a recipe while it is being developed before the sources are uploaded.

Example request: Validate a recipe

$ curl -X PUT "https://api.mapbox.com/tilesets/v1/validateRecipe?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-d @recipe.json \
--header "Content-Type:application/json"

Response: Validate a recipe

The response will be a JSON object that tells you whether the recipe document is valid or not. If the recipe document is not valid, the errors property will contain an informational message about the issue.

Example response: Validate a recipe

Valid recipe:

{
"valid": true
}

Recipe not valid:

{
"valid": false,
"errors": ["minzoom 22 cannot be larger than maxzoom 11"]
}

Retrieve a tileset's recipe

get
https://api.mapbox.com/tilesets/v1/{tileset_id}/recipe
tilesets:list

Request the recipe body that you used when you created a specific tileset.

Required parameterTypeDescription
tileset_idstringThe ID for the tileset for which to retrieve the recipe, which is composed of your username followed by a period and the tileset's unique name (username.id).

Example request: Retrieve a tileset's recipe

$ curl "https://api.mapbox.com/tilesets/v1/{tileset_id}/recipe?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Retrieve a tileset's recipe

Returns the recipe body you provided when you originally created the specified tileset.

Example response: Retrieve a tileset's recipe

{
"recipe": {
"version": 1,
"layers": {
"my_layer": {
"source": "mapbox://tileset-source/my-source-data",
"minzoom": 0,
"maxzoom": 4
}
}
},
"id": "username.id"
}

Update a tileset's recipe

patch
https://api.mapbox.com/tilesets/v1/{tileset_id}/recipe
tilesets:write

Update a tileset’s recipe. This endpoint does a validation step on the new recipe.

Required parameterTypeDescription
tileset_idstringThe ID for the tileset for which you are updating the recipe, which is composed of your username followed by a period and the tileset's unique name (username.id).

The entire request body must be the recipe JSON document, which is the recipe part of the request body property of a tileset creation request.

Updates to the layer name

Updating the layer_name of your recipe will break any downstream styles that reference this tileset. If a style references this tileset and you change the layer_name, you must update your style by deleting the relevant layer and re-adding the tileset’s new layer.

Example request: Update a tileset's recipe

$ curl -X PATCH "https://api.mapbox.com/tilesets/v1/{tileset_id}/recipe?access_token=YOUR_MAPBOX_ACCESS_TOKEN" \
-d @recipe.json \
--header "Content-Type:application/json"

Response: Update a tileset's recipe

If the updated recipe is valid, the response will be HTTP 204 No Content.

If the updated recipe is not valid, the errors property will contain an informational message about the issue:

{
"message": "Recipe is invalid.",
"errors": ["minzoom 22 cannot be larger than maxzoom 11"]
}

List tilesets

get
https://api.mapbox.com/tilesets/v1/{username}
tilesets:list

List all the tilesets that belong to a specific account. This endpoint supports pagination. It returns a maximum of 100 tilesets by default.

Required parameterTypeDescription
usernamestringThe username of the account for which to list tilesets

You can further refine the results from this endpoint with the following optional parameters:

Optional parametersTypeDescription
typestringFilter results by tileset type, either raster or vector.
visibilitystringFilter results by visibility, either public or private. Private tilesets require an access token that belong to the owner. Public tilesets can be requested with any user's access token.
sortbystringSort the listings by their created or modified timestamps.
limitintegerThe maximum number of tilesets to return, from 1 to 500. The default is 100.
startstringThe tileset after which to start the listing. Find the key in the Link header of a response. See the pagination section for details.

Example request: List tilesets

$ curl "https://api.mapbox.com/tilesets/v1/{username}?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

# Limit the results to the 25 most recently created vector tilesets

$ curl "https://api.mapbox.com/tilesets/v1/{username}?type=vector&limit=25&sortby=created&access_token=YOUR_MAPBOX_ACCESS_TOKEN"

# Limit the results to the tilesets after the tileset with a start key of abc123

$ curl "https://api.mapbox.com/tilesets/v1/{username}?start=abc123&access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: List tilesets

A request to MTS returns an array of tileset objects. Each tileset object contains the following properties:

PropertyTypeDescription
typestringThe kind of data contained, either raster or vector.
centerarrayThe longitude, latitude, and zoom level for the center of the contained data, given in the format [lon, lat, zoom].
createdstringA timestamp indicating when the tileset was created.
descriptionstringA human-readable description of the tileset.
filesizeintegerThe storage in bytes consumed by the tileset.
idstringThe unique identifier for the tileset.
modifiedstringA timestamp indicating when the tileset was last modified.
namestringThe name of the tileset.
visibilitystringThe access control for the tileset, either public or private.
statusstringThe processing status of the tileset, one of: available, pending, or invalid. For tilesets created with the Mapbox Tiling Service, this is always set to available. To see the stage of a MTS tileset's most recent job, use the tileset jobs listing endpoint with a limit=1 query parameter.

Example response: List tilesets

[
{
"type": "vector",
"center": [-0.2680000000000007, 11.7014165, 2],
"created": "2015-09-09T23:30:17.936Z",
"description": "",
"filesize": 17879790,
"id": "mapbox.05bv6e12",
"modified": "2015-09-09T23:30:17.906Z",
"name": "routes.geojson",
"visibility": "public",
"status": "available"
},
{
"type": "raster",
"center": [-110.32479628173822, 44.56501277250615, 8],
"created": "2016-12-10T01:29:37.682Z",
"description": "",
"filesize": 794079,
"id": "mapbox.4umcnx2j",
"modified": "2016-12-10T01:29:37.289Z",
"name": "sample-4czm7e",
"visibility": "private",
"status": "available"
}
]

Supported libraries: List tilesets

Mapbox wrapper libraries help you integrate Mapbox APIs into your existing application. The following SDK supports this endpoint:

See the SDK documentation for details and examples of how to use the relevant methods to query this endpoint.

Delete tileset

delete
https://api.mapbox.com/tilesets/v1/{tileset_id}
tilesets:write

Delete a tileset. Note that you can only delete your own tileset.

Required parameterTypeDescription
tileset_idstringThe ID of the tileset you want to delete, which is composed of your username followed by a period and the tileset's unique name (username.id).

Example request: Delete tileset

$ curl -X DELETE "https://api.mapbox.com/tilesets/v1/{tileset_id}?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Delete tileset

HTTP 200

Retrieve TileJSON metadata

get
https://api.mapbox.com/v4/{tileset_id}.json

Given a valid Mapbox tileset ID, returns TileJSON metadata for that tileset.

Required parametersTypeDescription
tileset_idstringUnique identifier for the vector tileset in the format username.id. To composite multiple vector tilesets, use a comma-separated list of up to 15 tileset IDs.

This endpoint can be further customized with the optional secure parameter:

Optional parametersTypeDescription
securestringBy default, resource URLs in the retrieved TileJSON (such as in the "tiles" array) will use the HTTP scheme. Include secure in your request to receive HTTPS resource URLs instead.

Example request: Retrieve TileJSON metadata

$ curl "https://api.mapbox.com/v4/examples.civir98a801cq2oo6w6mk1aor-9msik.json?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

# Request HTTPS resource URLs in the retrieved TileJSON
$ curl "https://api.mapbox.com/v4/examples.civir98a801cq2oo6w6mk1aor-9msik.json?secure&access_token=YOUR_MAPBOX_ACCESS_TOKEN"

Response: Retrieve TileJSON metadata

Returns TileJSON metadata for a tileset. The TileJSON object describes a map's resources, like tiles, markers, and UTFGrid, as well as its name, description, and centerpoint.

Example response: Retrieve TileJSON metadata

{
"bounds": [-87.769775, 41.715515, -87.530221, 41.940403],
"center": [-87.649998, 41.82795900000001, 0],
"created": 1479169405055,
"filesize": 3321,
"format": "pbf",
"id": "examples.civir98a801cq2oo6w6mk1aor-9msik",
"mapbox_logo": true,
"maxzoom": 10,
"minzoom": 0,
"modified": 1542143499397,
"name": "chicago-parks",
"private": false,
"scheme": "xyz",
"tilejson": "2.2.0",
"tiles": [
"http://a.tiles.mapbox.com/v4/examples.civir98a801cq2oo6w6mk1aor-9msik/{z}/{x}/{y}.vector.pbf",
"http://b.tiles.mapbox.com/v4/examples.civir98a801cq2oo6w6mk1aor-9msik/{z}/{x}/{y}.vector.pbf"
],
"vector_layers": [
{
"description": "",
"fields": {
"description": "String",
"id": "String",
"marker-color": "String",
"marker-size": "String",
"marker-symbol": "String",
"title": "String"
},
"id": "chicago-parks",
"maxzoom": 22,
"minzoom": 0,
"source": "examples.civir98a801cq2oo6w6mk1aor-9msik",
"source_name": "chicago-parks"
}
],
"version": "1.0.0",
"webpage": "http://a.tiles.mapbox.com/v4/examples.civir98a801cq2oo6w6mk1aor-9msik/page.html"
}

Retrieve tileset activity

get
https://api.mapbox.com/activity/v1/{username}/tilesets

Lists 30-day activity data for all tilesets belonging to a specific account. This endpoint supports pagination, returning 100 activity objects by default and a maximum of 500.

Required parametersTypeDescription
usernamestringThe username of the account for which the resource activities will be retrieved.

You can further refine the results from this endpoint with the following optional parameters:

Optional parametersTypeDescription
sortbystringSort the listings by their requests or modified. The default is requests.
orderbystringSort direction, asc or desc. The default is desc.
limitintegerThe maximum number of activity data to return, from 1 to 500. The default is 100.
startstringThe activity data after which to start the listing. Find the key in the Link header of a response. See the pagination section for details.

Example request: Retrieve tileset activity

$ curl "https://api.mapbox.com/activity/v1/{username}/tilesets?access_token=YOUR_MAPBOX_ACCESS_TOKEN"

# Limit the results to the 25 most requested tilesets in the past 30 days
$ curl "https://api.mapbox.com/activity/v1/{username}/tilesets?access_token=YOUR_MAPBOX_ACCESS_TOKEN&limit=25&sortby=requests&orderby=desc"

Response: Retrieve tileset activity

Returns an array of activity objects. Each activity object contains the following properties:

PropertyTypeDescription
idstringThe unique tileset Id.
request_countnumberThe total number of requests in last 30 days
last_modifiedstringA timestamp indicating when the tileset's request count was last modified.

Example response: Retrieve tileset activity

[
{
"id": "TestAccount.00y37ujk",
"request_count": 5887624756,
"last_modified": "2023-06-19T00:31:10.226Z"
},
{
"id": "TestAccount.ck29mgmu80bni2in6s83k6e1q-1y1m7",
"request_count": 5887579047,
"last_modified": "2023-06-19T00:31:10.226Z"
}
]

Mapbox Tiling Service errors

Response body messageHTTP status codeDescription
Not Authorized - No Token401No token was used in the query.
Not Authorized - Invalid Token401Check the access token you used in the query.
This endpoint requires a token with {scope} scope403The access token used in the query needs the specified scope.
Forbidden403There may be an issue with your account. Check your Account page for more details.

In some cases, using an access tokens with URL restrictions can also result in a 403 error. For more information, see our Token management guide.
Not Found404The resource or the account does not exist.
Cannot find tileset404Check the tileset ID you used in the query.
The requested url's querystring \"limit\" property contains in invalid value.422The limit specified in the query is larger than 500, or contains non-numeric characters.
Resource is locked and cannot be modified409A tileset source is "locked" when in use by an active tileset publish job. While locked the resource cannot be deleted or modified. Once a publish job is complete the resource is unlocked.
Invalid start key422Check the start key used in the query.
Classic styles are no longer supported; see https://blog.mapbox.com/deprecating-studio-classic-styles-d8892ac38cb4 for more information410This is a deprecation notice from API requests for Classic styles, which are no longer supported.

For help troubleshooting common errors, see our MTS errors documentation.

Mapbox Tiling Service restrictions and limits

  • You must make requests over HTTPS. HTTP is not supported.
Mapbox Tiling Service endpointRequests per minuteSize limits
Create a tileset source100Tileset sources can be composed of up to 10 source files.

Each uploaded file must have a maximum size of 20 GB. The maximum combined total size of all files that compose a tileset source is 50 GB. If the total size of all the files that compose a tileset source is greater than 50 GB, MTS will return a response that contains an error property with more details.
Retrieve tileset source information3,000
List tileset sources3,000
Delete a tileset source100
Create a tileset100
Publish a tileset2The size of a single vector tile is limited to 500 KB. If a job drops features due to tile size, this will be noted in the warnings field of the job object.
Update tileset information100
Retrieve information about a single tileset job3,000
List information about all jobs for a tileset3,000
View the global queue3,000
Validate a recipe100
Retrieve a tileset's recipe3,000
Update a tileset's recipe100
List tilesets3,000
Delete a tileset100
Retrieve TileJSON metadata100,000
Retrieve tileset activity500
If you require a higher rate limit, contact us.

Caching

  • TileJSON responses set default Cache-Control headers to max-age=43200,s-maxage=300, or a device cache TTL of 12 hours and a CDN cache TTL of 5 minutes.
  • For general information on caching, see the Maps APIs caching troubleshooting guide.

Mapbox Tiling Service pricing

  • Billed by tileset processing and tileset hosting
  • See rates and discounts per tileset processing and tileset hosting in the pricing page's Tilesets section

When you use Mapbox Tiling Service, usage statistics can be reviewed on your Statistics dashboard. If an account's Tilesets usage exceeds the monthly free tier, you will see two different line items on the account's invoice: tileset processing and tileset hosting. The cost of each will depend on the area of your tiled data and the precision level of your tilesets.

To see details on the precision level and area tiled for a specific tileset, go to your Tilesets page and click on the tileset's name to visit the Tileset explorer. The Tileset explorer provides a link to the pricing calculator in the Billing metrics section, where you can input the square kilometers of your tiled data for a pricing estimate.

To learn more about how pricing works for this service, see the MTS pricing guide.

Was this page helpful?