Introduction
Programmatic read access to your team's style guides.
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
Generate a token from your team's settings page. Tokens may also be passed as ?key=<token> for legacy compatibility.
Endpoints
GET api/whoami
Example request:
curl --request GET \
--get "http://localhost/api/whoami" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/whoami"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"error": {
"code": "unauthenticated",
"message": "A valid API token is required."
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Style Guides
List style guides for the authenticated team.
requires authentication
Returns every style guide owned by the calling team, including sections, rules, glossary terms, preferred spellings, and inheritance.
Example request:
curl --request GET \
--get "http://localhost/api/style-guides" \
--header "Authorization: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/style-guides"
);
const headers = {
"Authorization": "Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, success):
[
{
"id": 1,
"external_name": "Brand Guide",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"sections": [],
"glossary_terms": [],
"preferred_spellings": [],
"inherited_style_guides": []
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List style guide summaries.
requires authentication
Returns just id, external_name, and uuid for each guide on the team.
Example request:
curl --request GET \
--get "http://localhost/api/style-guides/list" \
--header "Authorization: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/style-guides/list"
);
const headers = {
"Authorization": "Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
[
{
"id": 1,
"external_name": "Brand Guide",
"uuid": "550e8400-e29b-41d4-a716-446655440000"
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get a single style guide by UUID.
requires authentication
Example request:
curl --request GET \
--get "http://localhost/api/style-guides/550e8400-e29b-41d4-a716-446655440000" \
--header "Authorization: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/style-guides/550e8400-e29b-41d4-a716-446655440000"
);
const headers = {
"Authorization": "Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"id": 1,
"external_name": "Brand",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"sections": [],
"inherited_style_guides": []
}
Example response (404):
{
"error": {
"code": "not_found",
"message": "Style guide not found."
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Validate that a UUID corresponds to a guide the caller can access.
requires authentication
Example request:
curl --request GET \
--get "http://localhost/api/style-guides/6ff8f7f6-1eb3-3525-be4a-3932c805afed/validate" \
--header "Authorization: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/style-guides/6ff8f7f6-1eb3-3525-be4a-3932c805afed/validate"
);
const headers = {
"Authorization": "Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"success": true
}
Example response (404):
{
"error": {
"code": "not_found",
"message": "Style guide not found."
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List public style guides.
No authentication required. Returns guides explicitly marked public by their team.
Example request:
curl --request GET \
--get "http://localhost/api/public-guides" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://localhost/api/public-guides"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
[
{
"id": 1,
"external_name": "Public Demo",
"uuid": "550e8400-e29b-41d4-a716-446655440000"
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.