Skip to main content
For the complete documentation index, see llms.txt.

Styles

Map styles and their drafts. Every style carries a published version and a draft; Mapbox Studio edits the draft, and the three draft commands read and write it. A style's sprite sits at the same URLs but has a command group of its own. Every command also takes the common flags — --username/-u, --token/-t, --profile, --id — described in Shared parameters.

mapbox styles list​

Metadata for every style in an account.

Parameters:

ParameterDescription
--draftWhen present, includes draft styles in the listing.
--startStyle ID to use as a pagination cursor (exclusive).
--limitMaximum number of styles to return.
--deletedWhen true, returns recently deleted styles instead of active ones.

Examples:

mapbox styles list
mapbox styles list --limit 5

mapbox styles get​

One style document, conforming to the Mapbox Style Specification.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.
--downloadWhen present, returns the style as a downloadable JSON file attachment.
--optimizeWhen true, rewrites vector source URLs for cache optimization.

Examples:

mapbox styles get ckstyle00000000000000001a
mapbox styles get ckstyle00000000000000001a -o json > style.json

mapbox styles create​

Adds a new style. The server fills in created, id, modified, owner and the sprite URL; name defaults to the style ID if the body omits it.

Parameters:

ParameterDescription
--data/-dRequest body as a JSON string, or @<path> to read it from a file and @- from stdin.

Examples:

mapbox styles create \
-d '{"name":"My Style","version":8,"sources":{},"layers":[]}'
mapbox styles create -d @style.json

mapbox styles update​

Modifies an existing style. The body needs name, and must not carry created or modified. A cross-version update — v7 to v8 — fails.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.
--data/-dRequest body as a JSON string, or @<path> to read it from a file and @- from stdin.

Examples:

mapbox styles update ckstyle00000000000000004d \
-d '{"name":"Renamed","version":8,"sources":{},"layers":[]}'
jq '.name = "Renamed"' style.json | mapbox styles update ckstyle00000000000000004d -d @-

mapbox styles delete​

Removes a style and its sprites. Mapbox keeps a deleted style recoverable for 30 days, but the CLI has no command to bring one back.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.

Examples:

mapbox styles delete ckstyle00000000000000003c

mapbox styles download​

The style as a ZIP: style.json, every sprite icon as an SVG under sprite_images/, the custom fonts it uses under fonts/, and a license file. Only the style's owner can download it, and the account needs access to this API, which Mapbox grants on request. A login from before this command shipped lacks the styles:download scope; run mapbox auth login again.

The response is binary, so the CLI refuses to write it to a terminal. Redirect it to a file.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.

Examples:

mapbox styles download ckstyle00000000000000001a > style.zip

mapbox styles draft get​

The draft version of a style. With no draft, the published style comes back instead — which is also how you can tell a draft was discarded.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.

Examples:

mapbox styles draft get ckstyle00000000000000004d

mapbox styles draft update​

Updates the draft, creating one from the published version if none exists. The published style stays as it was until Studio publishes the draft.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.
--data/-dRequest body as a JSON string, or @<path> to read it from a file and @- from stdin.

Examples:

mapbox styles draft update ckstyle00000000000000004d \
-d '{"name":"Work in progress","version":8,"sources":{},"layers":[]}'

mapbox styles draft delete​

Discards the draft, reverting the style to its published version.

Parameters:

ParameterDescription
<style-id>Unique identifier for the style.

Examples:

mapbox styles draft delete ckstyle00000000000000004d
Was this page helpful?