Menu

Getting Started with the API

The Thinkific API enables you to create a powerful and customized online educational solution that is built on the Thinkific experience. Build a customized e-commerce experience, manage your content, support users, and more. Explore the documentation here to learn how!


Current API version: V1.0.0


Authenticating

Before you can begin to interact with Thinkific API, your app needs to access the necessary credentials and include them in each request to Thinkific.


Authentication is achieved by providing both the subdomain and corresponding API key as a Header in each request. Structure of headers:


Key

Value

X-Auth-API-Key

{{Thinkific API key}}

X-Auth-Subdomain

{{Subdomain of the Thinkific site}}

Content-Type

application/json


Base URL Path

All Endpoints will begin with https://api.thinkific.com/api/public/v1/


Making your first request

In order to get started with the API a Thinkific account is required. Gain access to your API key and subdomain by logging into your account, navigating to “Settings” and then to the “Code & Analytics” tab > "API".


Note that access to Thinkific's Public API is available on the Pro plan plus Growth package or higher. If you receive an authentication error when attempting to connect to the API, you will need to upgrade your plan.

 


Test your connection by retrieving a list of your courses using the following command in your console. Make sure you replace “my-api-key” and “my-subdomain” with your own credentials.


curl https://api.thinkific.com/api/public/v1/courses \
-H 'X-Auth-API-Key: my-api-key' \
-H 'X-Auth-Subdomain: my-subdomain' \
-H 'Content-Type: application/json'



Authentication Errors

Errors due to invalid or incorrect credentials will respond with an HTTP status code of 401 and the payload body will include a JSON formatted error:

{'error':'Authentication Error'}

Rate Limits

Requests to the Thinkific API for any one account are limited to no more than 1000 request per minute. In the case that this maximum is exceeded, you will receive a 403 HTTP status code with the following response:

"Rate Limit Exceeded"


Cross Origin Requests

Cross origin requests are supported, although it should be noted that making calls to the the API using client-side javascript is insecure and not recommended, as it exposes your API key to the public to be easily discovered and used to make changes to the Thinkific account. 


We recommend that all communication to the Thinkific API be routed through your server as a proxy to ensure that you do not expose your API key publicly.


Data & Date Formatting

All data is returned in JSON format. All dates and timestamps are returned and expected in ISO 8601 format: 

YYYY-MM-DDTHH:MM:SSZ

Pagination

All collections returned from Thinkific have a default limit of 25 items in each requests. Access to larger data sets can be accomplished using the following methods


Paging through items

You can access items on subsequent pages by specifying the "page" parameter for a collection of items. This is useful in combination with the limit parameter to loop until all items have been retrieved.


As an example the following request will return the second page of results (26 - 50) for your data-set:

curl https://api.thinkific.com/api/public/v1/courses?page=2 -H 'X-Auth-API-Key: my-api-key' -H 'X-Auth-Subdomain: my-school'


Increasing the limit

The default limit may be overridden by providing a "limit" parameter in your request. You can increase the limit returned per page up to a maximum of 250 items per request.


As an example, the following request will increase the items return per page to 50 and will return the second page of items:

curl https://api.thinkific.com/api/public/v1/courses?limit=50&page=2 -H 'X-Auth-API-Key: my-api-key' -H 'X-Auth-Subdomain: my-school'


Pagination Body Structure

All endpoints that return a collection of items will include two objects, an items array with the requested data-set, and a meta object that includes pagination information.


You can use the information in the pagination hash to determine your current state/location and whether there are more items that are available to fetch.


An example of what this might look like:   


{  
   "items":[  
      {  
         "id":123456,
         "created_at":"2019-05-22T16:07:37.825Z",
         "first_name":"Bob",
         "last_name":"Smith",
         "full_name":"Bob Smith",
         "company":"A Company",
         "email":"something@example.com",
         "roles":[  
            "course_admin"
         ],
         "avatar_url":null,
         "bio":null,
         "headline":null,
         "affiliate_code":null,
         "external_source":null,
         "affiliate_commission":null,
         "affiliate_commission_type":"%",
         "affiliate_payout_email":null,
         "administered_course_ids":[  
            1,
            2
         ],
         "custom_profile_fields":[  
            {  
               "id":1,
               "value":"Canada",
               "label":"Country",
               "custom_profile_field_definition_id":1
            },
            {  
               "id":2,
               "value":"778-877-1000",
               "label":"Phone Number",
               "custom_profile_field_definition_id":2
            }
         ]
      }
   ],
   "meta":{  
      "pagination":{  
         "current_page":1,
         "next_page":null,
         "prev_page":null,
         "total_pages":1,
         "total_items":7,
         "entries_info":"1 of 7"
      }
   }
}



Validation Errors

All create and update operations have the potential to return validation errors if they are passed invalid data. 


When this occurs the response will return with an HTTP status code of 422 and will include an error message that identifies the problem. The structure of this message includes an errors object with the error message details enclosed:


An example of an error when creating a new user might include:

{
'errors': {
        'email': ['has already been taken'],
        'password':['is too short (minimum is 6 characters)'']
}
}


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.