Teem Developer Portal

Optimize your new digital workspace with the Teem developers API.

Registering your app for the Teem API

These are meant for developers experienced in working with APIs and are sufficient to get you started using ours. If you would like additional information regarding how to use an API for the first time, check out this free online course or contact us for a consultation with one of our Sales Engineers at [email protected].

To use the Teem API in your own app, you need to first register your app and receive a Client ID to represent your application in API calls.

Teem OAuth Flow

1

Authorize

Give your user a link, which redirects them to Teem's authorization endpoint with the appropriate query parameters.

Auth Code Request Endpoint
https://app.teem.com/oauth/authorize/
Query Parameters for Auth Code Request

Name Type Description
client_id string Required. The client ID that you received from Teem when you registered your application.
redirect_uri string Required. Must match the callback URL that you supplied during application registration. This is the URL where users will be sent after authorization.
response_type string Required. Must be set to "code" to request an authorization code.
scope string Required. See the API docs for the endpoints you want to use to determine the scopes you need. We recommend that you always request the users scope.
state string Recommended. An unguessable random string, used to protect against request forgery attacks.

Example:
https://app.teem.com{% url "oauth:authorize" %}?client_id=<app_id>&redirect_uri=http://example.com/callback&response_type=code&scope=reservations
2

Authorization Response

The user logs into Teem and is asked to authorize your app with the scopes you have requested.

If the user authorizes the request, they will be redirected to the supplied redirect_uri along with an authorization code supplied as a query parameter. For example:

https://example.com/callback?code=$RESPONSE_CODE&state=$OPTIONAL_STATE_STRING
3

Request Access Token

You must now exchange the authorization code we return for an access token. This requires a POST request to the token endpoint.

Access Token Request Endpoint
https://app.teem.com/oauth/token/

Use below parameters in request body 'x-www-form-urlencoded'
Token Request POST Parameters

Name Type Description
client_id string Required. The client ID that you received from Teem when you registered your application.
client_secret string Required. The client secret that you were given from Teem when you registered.
grant_type string Required. Must be set to "authorization_code" for an access token request.
redirect_uri string Required. Must match the callback URL that you supplied during application registration.
code string Required. The code that you received as a response in Step 2.

Example:
curl --location --request POST 'https://app.teem.com/oauth/token/' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=$CLIENT_ID' --data-urlencode 'client_secret=$SECRET' --data-urlencode 'grant_type=authorization_code' --data-urlencode 'redirect_url=$REDIRECT_URI' --data-urlencode 'code=$CODE'
Token Request Response

The http response will include data:

Name Type Description
access_token string Token used to authorize your API requests.
token_type string Type of access token, will generally be "Bearer"
expires_in integer Seconds until the token expires, generally 3600
refresh_token string Token to exchange used to receive a new access token without sending the user through the auth flow again.

4

Use the Access Token

To access an OAuth protected API you simply include bearer token authorization request header:

Authorization: Bearer $TOKEN
Example:
curl -X GET "https://app.teem.com/api/v4/accounts/users/me/" -H "Authorization: Bearer $TOKEN"
5

Use the Refresh Token

Refresh Tokens differ from Access Tokens in that Access Tokens are short-lived and multi-use, but Refresh Tokens are valid for 90 days and are single-use. Using a Refresh Token will return a new Access Token and Refresh Token, allowing you to continue to use the API without having the user reauthorize.

Refresh Token Request Endpoint
https://app.teem.com/oauth/token/
Refresh Token POST Parameters

Name Type Description
client_id string Required.The client ID that you received from Teem when you registered your application.
client_secret string Required. The client secret that you were given from Teem when you registered.
grant_type string Required. Must be set to "refresh_token" for a refresh token request.
refresh_token string Required. The refresh_token given to you with your access_token in previous steps.

Example:
curl -X POST -d "client_id=$APP_ID &client_secret=$APP_SECRET &refresh_token=$REFRESH_TOKEN &grant_type=refresh_token"
Token Request Response

The http response will include data:

Name Type Description
access_token string Token used to authorize your API requests.
token_type string Type of access token, will generally be "Bearer"
expires_in integer Seconds until the token expires, generally 3600
refresh_token string Token to exchange used to receive a new access token without sending the user through the auth flow again.