API Reference
The Ditto API allows you to read and write information from your Ditto workspace.

Overview

The Ditto API currently supports read access of Ditto workspaces and is served over HTTPS. All endpoint URLs have the following base: https://api.dittowords.com.

Authentication

To access any Ditto API endpoints, you'll need an API key. You can view, create, and revoke your API keys in your Account Settings.
Each API key is attached to a specific user and can only be used to fetch information from that user's Ditto workspace.

Creating an API key

If you already have a Ditto account, you can create an API Key as follows:
  1. 1.
    Head to your Account Settings​
  2. 2.
    Under the section titled API Keys, click + Create key.
The User tab under the Account Settings page.

Using an API key

To use your API key to make a request to the Ditto API, you'll need to pass it in an Authorization header in all requests:
1
'Authorization: token <YOUR_API_KEY>'
Copied!
Here's an example request to Ditto's /projects endpoint:
1
curl GET 'https://api.dittowords.com/projects' \
2
--header 'Authorization: token <YOUR_API_KEY>'
Copied!
Only projects that have Developer Mode enabled are accessible via the API. Learn more about Developer Mode here.
get
https://api.dittowords.com
/project-names
List project names
Example Request
1
curl GET 'https://api.dittowords.com/projects' \
2
--header 'Authorization: token <YOUR_DITTO_API_KEY>'
Copied!
get
https://api.dittowords.com
/projects/:id
Fetch project by ID
Example Request
1
curl GET 'https://api.dittowords.com/projects/<DITTO_PROJECT_ID>' \
2
--header 'Authorization: token <YOUR_DITTO_API_KEY>'
Copied!
get
https://api.dittowords.com
/projects
Fetch projects
get
https://api.dittowords.com
/variants
Fetch variants
1
curl GET 'https://api.dittowords.com/variants' \
2
--header 'Authorization: token <YOUR_DITTO_API_KEY>'
Copied!
get
https://api.dittowords.com
/components
Fetch components
1
# Request
2
curl GET 'https://api.dittowords.com/components' \
3
--header 'Authorization: token <YOUR_DITTO_API_KEY>'
4
5
# Example Response
6
{
7
"footer.about.blog": {
8
"name": "Footer/About/Blog",
9
"text": "Blog"
10
},
11
"footer.about.careers": {
12
"name": "Footer/About/Careers",
13
"text": "Careers"
14
}
15
...
16
}
Copied!
put
https://api.dittowords.com
/components
Update components
1
# Request
2
curl PUT 'https://api.dittowords.com/components?variant={variant_api_id}' \
3
--header 'Authorization: token <YOUR_DITTO_API_KEY>' \
4
--data '{ "data": { "hello": "world" } }'
5
​
6
# Example Response
7
{
8
"componentsUpdated": 1,
9
"componentsSkipped": 0
10
}
11
Copied!
Last modified 8d ago