We recently released a limited public API in beta. API access and keys are only available on our paid plans. Our API allows you to create new pages and suggestions, as well as search your Tettra pages.
API Key and Team ID
To generate or view your API key visit the 'Integrations' section of your user settings page. The API key is unique to your user and team and has the same permissions as your user. Your team_id
is also available on this page.
Endpoints
Search
Returns up to 5 page results for the given search term
URL: https://app.tettra.co/api/teams/{{team_id}}/search
HTTP Method: GET
Arguments:
api_key
- required - your API keyquery
- optional - the search term; returns most recent pages if omitted
Example Request
curl -X GET \
-H 'Content-Type: application/json' \
--data \
'{
"api_key":"xxxxxxxxxxxxxxxxxx1234567890",
"query":"Company Holidays"
}' \
https://app.tettra.co/api/teams/5/search
Example Response
{
success: true,
query: "Company Holidays",
pages: [
{
id: 2,
title: "2020 Company Holidays",
updated_at: "2020-06-03T17:10:24.000000Z",
url: "https://app.tettra.co/teams/example/pages/2020-company-holidays",
content: "{"blocks":[{"key":"avkfq","text":"example content","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}",
owner: "Andy",
category: {
id: 1,
name: "Office & Ops",
url: "https://app.tettra.co/teams/example/categories/1"
}
}
]
}
Create Page
Publishes a new Tettra page from the given HTML content.
URL: https://app.tettra.co/api/teams/{{team_id}}/pages
HTTP Method: POST
Arguments:
api_key
- required - your API key; this determines the author of the pagetitle
- required - the title of the pagebody
- required - the body of the page formatted as HTMLcategory_id
- optional - the category to publish the page to
Example
curl -X POST \
-H 'Content-Type: application/json' \
--data \
'
{
"api_key":"xxxxxxxxxxxxxxxxxx1234567890",
"title":"My Awesome Page",
"body":"<h1>Hello World!</h1>"
}
' \
https://app.tettra.co/api/teams/2/pages
Suggest a New Page
Creates a new page suggestion.
URL: https://app.tettra.co/api/teams/{{team_id}}/suggestions
HTTP Method: POST
Arguments:
api_key
- required - your API key; this determines the creator of the suggestiontitle
- required - title of suggestiondescription
- optional - more context about the suggested pagecategory
- optional - the category to publish the page toassignable_id
- optional - the id of the user to assign the suggestion
Example
curl -X POST -H 'Content-Type: application/json' \
--data \
'{
"api_key":"xxxxxxxxxxxxxxxxxx1234567890",
"title":"A new page about something I want to know",
"description":"A question that should be documented",
"category":2,
"assignable_id":22
}' \
https://app.tettra.co/api/teams/2/suggestions
Suggest Page Update
Creates a new suggestion to update an existing page.
URL: https://app.tettra.co/api/teams/{{team_id}}/suggestions
HTTP Method: POST
Arguments:
api_key
- required - your API key; this determines the creator of the suggestionupdate
- required - (boolean) indicates this is a suggestion for an update to an existing page (instead of a new page)page_id
- required - the id of the page that needs updatingdescription
- optional - more context about the suggested changeassignable_id
- optional - the id of the user to assign the suggestion
Example
curl -X POST -H 'Content-Type: application/json' \
--data \
'{
"api_key":"xxxxxxxxxxxxxxxxxx1234567890",
"update":true,
"description":"Update this outdated page",
"page_id":2,
"assignable_id":22
}' \
https://app.tettra.co/api/teams/2/suggestions
Future Work
If you have a good use case or idea for other API capabilities, or would like to collaborate, send us a message. We also support integrations via Zapier.
Note that our API is still experimental, and we may make breaking, non-backwards-compatible changes.