MENU navbar-image

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."
    }
}
 

Request      

GET api/whoami

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

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": []
    }
]
 

Request      

GET api/style-guides

Headers

Authorization        

Example: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Content-Type        

Example: application/json

Accept        

Example: application/json

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"
    }
]
 

Request      

GET api/style-guides/list

Headers

Authorization        

Example: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Content-Type        

Example: application/json

Accept        

Example: application/json

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."
    }
}
 

Request      

GET api/style-guides/{uuid}

Headers

Authorization        

Example: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

uuid   string     

The guide's UUID. Example: 550e8400-e29b-41d4-a716-446655440000

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."
    }
}
 

Request      

GET api/style-guides/{uuid}/validate

Headers

Authorization        

Example: Bearer stk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

uuid   string     

The guide's UUID. Example: 6ff8f7f6-1eb3-3525-be4a-3932c805afed

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"
    }
]
 

Request      

GET api/public-guides

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json