Requests made to the API are made using the developers.teachable.com base URL.

The API uses standard HTTP methods for indicating which actions to take on a resource:

MethodAction
GETRetrieve a resource
POSTCreate a new resource
PATCHPartially modify an existing resource
DELETERemove a resource

Headers

There are several headers you may need to include in your request.

HeaderUse Case
apikeyThe apikey header authorizes your request and will include your unique API key—learn more about authentication.
Accept- The Accept header tells the API in which format to return the response. By default, this is set to application/json.
Content-TypeThe Content-Type header tells the API about the format of the data being sent. This is required when including a request body with a POST, PATCH, or DELETE request.

This must be set to application/json.

Example header:

cURL —-header ‘apikey: YOURAPIKEYHERE’ \
     —-header 'Content-Type: application/json' \
     --header `Accept: application/json'

Request bodies

When making POST, PATCH, or DELETE requests, you must add a request body (i.e., the included data) in JSON.

Example request body format:

cURL —-data '
{
     "key": value
}
'

For example, if you want to use the API to create a new user in your school, you will need to make a POST request to the users endpoint. This will require you to include a request body in your call, as you'll need to include some data about the new user (e.g., their name and email address).

For this particular example, the request body of a call to the users endpoint is formatted as follows:

cURL --data '
{
     "email": "[email protected]",
     "password": "password123"
}
'

Example of a request

As mentioned above, your request might need various header and body content, depending on the request type you're making.

For example, a call to the users endpoint requires the following:

  • A request type (i.e., POST)
  • A base URL where the call is made (i.e., developers.teachable.com)
  • A header with both your API key for authorization, and an indicated content-type
  • A request body that includes data about the new user

All together, a call to the users endpoint would be formatted as follows:

cURL --request POST \
     --url https://developers.teachable.com/users \
     --header 'Content-Type: application/json' \
     --header 'apikey: YOURAPIKEYHERE' \
     --data '
{
     "email": "[email protected]",
     "password": "password123",
     "name": "John Doe"
}
'

🚧

You can use the "Try It!" feature in the reference documentation to make requests to the API. However, be aware that using this function makes a an actual to the API—and therefore, will get and/or post real data to/from your Teachable school.