#docs #api #advanced

Get an API Token

To interact with the TelemetryDeck API, you'll have to supply a 🐻 bearer token with each request that authenticates you with the API servers. Treat the bearer token as a secret, and store it as safely as a password.

Generating a Bearer Token with the API

To retrieve a bearer token, send a POST request to the following URL:

https://api.telemetrydeck.com/api/v3/users/login

The POST request needs to have its Authorization header set to Basic <base64 encoded username:password>. A body is not necessary.

POST /api/v3/users/login HTTP/1.1
Authorization: Basic 
Content-Length: 0
Host: api.telemetrydeck.com

You will receive a response with a bearer token.

{
  "expiresAt": "2023-01-07T13:27:22+0000",
  "id": "de1e7e-facade-c0ffee-0ff1ce",
  "user": {
    "id": "BADA55-BADGE5"
  },
  "value": "🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻"
}

Store the value as your bearer token and use it as the Authorization header in subsequent requests.

Example: Retrieving your user information

As an example, lets retrieve your user information using the API:

GET /api/v3/users/info HTTP/1.1
Authorization: Bearer 🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻
Host: api.telemetrydeck.com

The response for this should look like this:

{
  "email": "you@example.com",
  "emailIsVerified": true,
  "firstName": "Daniel",
  "id": "BADA55-BADGE5",
  "isFoundingUser": true,
  "lastName": "Jilg",
  "organization": {
    "createdAt": "2020-12-31T23:00:00+0000",
    "name": "TelemetryDeck",
    "updatedAt": "2022-07-11T01:27:20+0000"
  },
  "receiveReports": "weekly"
}

Example 2: Retrieving your user information

As an example, lets retrieve your user information using the API:

GET /api/v3/users/info HTTP/1.1
Authorization: Bearer 🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻🐻
Host: api.telemetrydeck.com

The response for this should look like this:

{
  "email": "you@example.com",
  "emailIsVerified": true,
  "firstName": "Daniel",
  "id": "BADA55-BADGE5",
  "isFoundingUser": true,
  "lastName": "Jilg",
  "organization": {
    "createdAt": "2020-12-31T23:00:00+0000",
    "name": "TelemetryDeck",
    "updatedAt": "2022-07-11T01:27:20+0000"
  },
  "receiveReports": "weekly"
}