SmartDocumentor
  • Overview
    • SmartDocumentor
  • GETTING STARTED
    • About SmartDocumentor
    • How SmartDocumentor Works
    • Main concepts
      • Workspaces
      • Organization
    • Quickstart 101
    • Licenses
      • How to Buy?
      • Support
    • Privacy
    • Security
  • Technical
    • Initial Setup
    • Mappings
    • API Reference
      • [POST] Client Credentials Access Token
      • [GET] Task Status
      • [GET] Task Status List
      • [GET] Task Status List Paginated
      • [GET] Get Workspaces
      • [PATCH] Reprocess Task
      • [POST] Create Task
      • [POST] Create Batch
      • [GET] Get Batch
      • [GET] Get Batch Paginated
      • Transcripts
        • Speakers
          • Workspaces
            • [GET] Workspace Speakers
            • [PUT] Workspace Speakers
          • Tasks
            • [GET] Task Speakers
            • [POST] Task Speaker
            • [PUT] Task Speaker
            • [DELETE] Task Speaker
      • Invite Users
        • [GET] List Available Roles
        • Tenants
          • [GET] List All Tenant Users
          • [POST] Invite Users
        • Workspaces
          • [GET] List All Workspace Users
          • [POST] Invite Users
    • Folder Worker
    • Export
      • Webhooks
        • Webhook (Text Documents)
        • Webhook (Transcripts)
        • Webhook Url To File (Transcripts)
        • Webhook Url to File (Anonymization)
    • Changelog
  • FAQs
    • FAQs
Powered by GitBook
On this page
  • Client Credentials Access Token
  • Body
  • Example Request
  • Responses
  1. Technical
  2. API Reference

[POST] Client Credentials Access Token

PreviousAPI ReferenceNext[GET] Task Status

Last updated 6 months ago

Use this request to obtain an access token to authenticate against the SmartDocumentor API.

We use the for authentication with external client applications.

To find out how you can obtain your own Client ID / Client Secret pair, check the section.

Re-using access tokens

While the API allows you to request as many access tokens as necessary, it is recommended to cache the access token for performance. Only request a new token once the previous one expires.

Client Credentials Access Token

POST /connect/token

Body

Name
Type
Description

grant_type

client_credentials

scope

WebAPI

Age The scope(s) used to request access. MUST always be "WebAPI".

client_id

{your Client ID}

client_secret

{your Client Secret}

Example Request

curl --location 'https://cloud.smartdocumentor.net/connect/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=client_credentials'
--data-urlencode 'scope=WebAPI'
--data-urlencode 'client_id={your Client ID}'
--data-urlencode 'client_secret={your Client Secret}'
client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://cloud.smartdocumentor.net/connect/token");

var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("grant_type", "client_credentials"));
collection.Add(new("scope", "WebAPI"));
collection.Add(new("client_id", "{your Client ID}"));
collection.Add(new("client_secret", "{your Client Secret}"));

var content = new FormUrlEncodedContent(collection);
request.Content = content;

var response = await client.SendAsync(request);

response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

import requests

url = "https://cloud.smartdocumentor.net/connect/token"

client_id = {your Client ID}
client_secret = {your Client Secret}

payload = f'grant_type=client_credentials&scope=WebAPI&client_id={client_id}&client_secret={client_secret}'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

const urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "client_credentials");
urlencoded.append("scope", "WebAPI");
urlencoded.append("client_id", {your Client ID});
urlencoded.append("client_secret", {your Client Secret});

const requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};

fetch("https://cloud.smartdocumentor.net/connect/token", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Responses

{
    "access_token": "your access token",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": "WebAPI"
}

Response Body AccessTokenResponse

Name
Type
Description

access_token

string

Your new access token. Add this to future requests as a Bearer token to perform authenticated requests against the API.

expires_in

integer

Tokens have a default expiration time of 3600 seconds (1 hour).

token_type

string

The type of token you issued. Always "Bearer".

scope

string

The scopes your access token has access to, seperated by spaces. Will always be "WebAPI".

{
    "error": "invalid_client"
}

Response Body

Name
Type
Description

erro

string

Details about the error that occured.

Getting invalid_client errors?

The grant type used to request the token. Always "client_credentials" as per the

Your , tied to your organization.

Your , tied to your Client ID.

Check if your Client ID and Client Secret pair is correct and has not expired. Head to the section to learn more.

client credentials flow
client credentials OAuth2.0 flow
Create Secrets
Create Secrets
Client ID
Client Secret