Skip to main content
This guide walks you through obtaining an access token and making your first API request. You’ll need about five minutes and a terminal with curl available.

Prerequisites

Before you begin, make sure you have:
  • A Flextell account at dev.flextell.ai
  • A registered application, which gives you a client_id and client_secret
To register an application, log in to your Flextell account, navigate to Applications, and create a new app. Record your client_id and client_secret — you’ll need them below.

Steps

1

Complete the OAuth 2.0 authorization flow

Redirect your user to the Flextell authorization URL so they can grant your application access:
https://dev.flextell.ai/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=YOUR_SCOPES
After the user approves, Flextell redirects them to your redirect_uri with an authorization code in the query string:
https://your-app.example.com/callback?code=AUTHORIZATION_CODE
Capture this code — you’ll exchange it for an access token in the next step.
2

Exchange the authorization code for an access token

Send a POST request to the token endpoint with your code and credentials:
curl --request POST \
  --url https://dev.flextell.ai/oauth/token \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "grant_type=authorization_code" \
  --data "code=AUTHORIZATION_CODE" \
  --data "client_id=YOUR_CLIENT_ID" \
  --data "client_secret=YOUR_CLIENT_SECRET" \
  --data "redirect_uri=YOUR_REDIRECT_URI"
A successful response returns a JSON object containing your access_token and a refresh_token:
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "def50200..."
}
Save both tokens securely. The access_token is used in every API request, and the refresh_token lets you obtain a new access token when it expires.
Never log or expose your client_secret or refresh_token. Store them in a secure secrets manager, not in source code or environment variables checked into version control.
3

Make your first API call

Include your access_token in the Authorization header as a Bearer token. The example below calls a hypothetical endpoint — replace the path with any Flextell endpoint you want to test:
cURL
curl --request GET \
  --url https://dev.flextell.ai/api/<endpoint> \
  --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --header "Accept: application/json"
A successful response returns 200 OK with a JSON body. If you receive a 401 Unauthorized response, double-check that your token is correctly formatted and has not expired.

What to do next

Authentication

Understand token expiry, refresh tokens, and security best practices.

API Reference

Browse every available endpoint, parameter, and response schema.