Skip to main content
Docktix

Docktix API: Authentication with OAuth 2.0

Connect your own software to a Docktix workspace. Your application obtains an access token through OAuth 2.0 and uses it to read and write your firm's data (records, documents, drive, e-signatures, users and more).

API base URLhttps://doc-management.docktix.com
Token endpointPOST https://doc-management.docktix.com/api/v1/oauth/v2/token
Request path prefix/docktix/api/v1/
Access tokenJWT, lifetime 3600 seconds (1 hour)
Grant typesauthorization_code (Self Client), client_credentials (Server-based), refresh_token
Request / response formatJSON. API calls are an HTTP POST whose body includes Firm_Id and Email (parameter-less reads are GET).

The token response contains api_domain and editor_api_domain. Use api_domain for most calls and editor_api_domain for the Writer (documents, templates) and Tags calls. Always take these values from the token response instead of hard-coding them.


1. How it works

text
 In Docktix (web app)                              Your application
 ────────────────────                              ────────────────
 1. Create an API client  ───────────────────────► client_id + client_secret
 2. (Self Client only) Generate a code ──────────► code (valid a few minutes, one use)
                                                      │
                                                      ▼
                                      3. POST /api/v1/oauth/v2/token  ──► access_token (+ refresh_token)
                                      4. POST /docktix/api/v1/...     Authorization: Bearer <access_token>  (body carries Firm_Id + Email)
                                      5. When the token expires: refresh it, or request a new one

The access token identifies your firm, the user it acts as and the scopes it may use. Every POST body states your Firm_Id and the Email of the user the token acts as; they are checked against the token (a mismatch answers 403) and never choose the firm or user for you. You never send a login or password with API calls.


2. Quick start

bash
export API="https://doc-management.docktix.com"
export EDITOR_API="<editor_api_domain from the token response>"   # Writer and Tags calls only
export CLIENT_ID="1000.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# 1. Request an access token (Server-based client)
curl -s -X POST "$API/api/v1/oauth/v2/token" \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d "grant_type=client_credentials" \
  -d "scope=DocktixCRM.modules.READ DocktixCRM.records.READ"
json
{
  "access_token": "1000.eyJhbGciOiJSUzI1NiIs…",
  "scope": "DocktixCRM.modules.READ DocktixCRM.records.READ",
  "api_domain": "https://doc-management.docktix.com",
  "editor_api_domain": "https://…",
  "token_type": "Bearer",
  "expires_in": 3600
}
bash
# 2. Call the API
export TOKEN="1000.eyJhbGciOiJSUzI1NiIs…"
curl -s "$API/docktix/api/v1/modules/list" \
  -H "Authorization: Bearer $TOKEN"

3. Register an API client

In Docktix open Settings → API Access and create a client. Only the firm Owner or a user with the Administrator profile can do this.

FieldDescription
Client nameA label for your integration.
Client typeSelf Client or Server-based (see below).
Redirect URIsServer-based only: 1–10 absolute https URLs (http is allowed for localhost). No fragments.
Allowed scopesThe most your client can ever request. Choose the minimum you need.

You receive a Client ID and a Client Secret. The secret is shown only once. Store it in a secret manager. If you lose it, rotate it in the same screen. You can set a grace period during which the old secret keeps working, and optionally revoke all tokens issued so far.

Client types

Self ClientServer-based
Best forScripts and one-off integrationsLong-running back-end services
How you get a tokenAn administrator generates a code in Docktix; you exchange it onceclient_credentials with Client ID + Client Secret
Refresh tokenYesNo: request a new access token when it expires
Acts asThe administrator who generated the codeThe administrator who registered the client

4. Get an access token

All token requests go to POST https://doc-management.docktix.com/api/v1/oauth/v2/token.

  • Authenticate your client with HTTP Basic (client_id:client_secret) or with client_id and client_secret in the body. If both are sent, Basic wins.
  • Body: application/x-www-form-urlencoded or JSON. Maximum 16 KB.
  • Responses are never cached (Cache-Control: no-store).

4.1 Self Client: exchange a code

In Settings → API Access choose your Self Client, select the scopes and a validity (1–10 minutes) and click Generate code. A code can be used once.

bash
curl -X POST "$API/api/v1/oauth/v2/token" \
  -d "grant_type=authorization_code" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET" \
  -d "code=$CODE"
json
{
  "access_token": "1000.eyJhbGciOiJSUzI1NiIs…",
  "refresh_token": "1000.<32 hex>.<32 hex>",
  "scope": "DocktixCRM.records.READ DocktixWriter.documents.READ",
  "api_domain": "https://doc-management.docktix.com",
  "editor_api_domain": "https://…",
  "token_type": "Bearer",
  "expires_in": 3600
}

Keep the refresh token safe; it lets you get new access tokens without a new code.

4.2 Server-based: client credentials

bash
curl -X POST "$API/api/v1/oauth/v2/token" \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d "grant_type=client_credentials" \
  -d "scope=DocktixCRM.records.READ"

scope is optional; without it you receive all of the client's allowed scopes. No refresh token is returned. Call this endpoint again when the token expires.

4.3 Refresh an access token

bash
curl -X POST "$API/api/v1/oauth/v2/token" \
  -d "grant_type=refresh_token" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET" \
  -d "refresh_token=$REFRESH_TOKEN"

Returns a new access token with the same scopes (or a narrower scope if you pass one, never a wider one). The refresh token itself stays the same. Limit: 10 new access tokens per refresh token per 10 minutes. Cache your access token for its full hour.

4.4 Revoke a token

bash
curl -X POST "$API/api/v1/oauth/v2/token/revoke" \
  -d "token=$REFRESH_TOKEN" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET"

token can be a refresh token or an access token. Always answers 200 {}. A client can only revoke its own tokens. Revocation takes effect within about a minute everywhere.

4.5 Token endpoint errors

Errors use the standard OAuth 2.0 JSON format with a real HTTP status: { "error": "...", "error_description": "..." }.

HTTPerrorMeaning
400invalid_requestA required parameter is missing, or the body is malformed or too large
400unsupported_grant_typeUse authorization_code, refresh_token or client_credentials
401invalid_clientUnknown client, wrong secret, or the client was revoked
400invalid_grantCode invalid, expired or already used; refresh token invalid or revoked
400invalid_scopeUnknown scope, or wider than your client / grant allows
400unauthorized_clientclient_credentials used with a Self Client
429rate_limitedToo many refreshes, or too many failed authentication attempts from your IP (30 per 10 minutes)
500server_errorTemporary problem on our side; retry later

Using an authorization code a second time is treated as a replay attack and revokes all tokens of that client. Generate a new code instead of retrying.


5. Call the API

Send the access token in the Authorization header. Both forms are accepted:

text
Authorization: Bearer 1000.eyJhbGciOiJSUzI1NiIs…
Authorization: Docktix-oauthtoken 1000.eyJhbGciOiJSUzI1NiIs…
bash
curl -X POST "$API/docktix/api/v1/records/list" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "Firm_Id": "<firm_id>", "Email": "<user_email>", "Module_Api": "contacts", "Page": 1, "Per_Page": 25 }'

Conventions

  • Calls are POST with a JSON body that always includes Firm_Id and Email. The five reads that take no parameters (modules/list, drive/resources/list, firm/details, users/list, profiles/list) are GET with no body.
  • Firm_Id and Email in every POST body must equal the firm and user the token carries: missing -> 400, different -> 403. Destructive routes (delete) also need "Confirm": true.
  • HTTP status codes are real: 200 success, 202 accepted (pending approval), 400 invalid request, 401 / 403 authorization problem, 404 not found, 409 conflict, 5xx server problem.
  • Success envelope:
json
{ "Status": "Success", "Code": 200, "Reason_Phrase": "…", "Exception_Message": null, "Details": … }

List routes also return paging information in Info.

  • Ids you send (Record_Id, Document_Id, …) must belong to your firm. Anything else answers 404 … not found.
  • Paging: Page (default 1), Per_Page (default 25, maximum 100).
  • Delete routes remove one item per call. Where noted, they also require "Confirm": true in the body.
  • Some features depend on your Docktix plan. If your plan does not include a feature, the call is refused with an explanatory message.

Authorization errors on API calls

Body: { "Status", "Code", "Reason_Phrase", "Exception_Message": null, "Error": "<code>", "Required_Scope": "<scope>" }. Required_Scope is present only for insufficient_scope. The WWW-Authenticate response header follows RFC 6750.

HTTPErrorCause and fix
401missing_tokenNo or malformed Authorization header, an unreplaced {{variable}}, or a token that is not an API access token
401token_expiredThe token expired. Refresh it or request a new one
401invalid_tokenThe token is not valid. Request a new one
401token_revokedThe token or its client was revoked. Request a new one
403insufficient_scopeThe route needs Required_Scope. Add it to the client, then request a new token
403tenant_mismatch, not_a_memberThe token's user no longer has access to this firm
404noneThe object does not exist in your firm, or API access is not enabled for your account
503noneTemporary problem. Retry shortly

6. Scopes

Format: Service.resource.OPERATION, for example DocktixCRM.records.READ. Operations are READ, CREATE, UPDATE, DELETE, EXECUTE, and ALL (every operation of that resource). Scopes are case-sensitive, and are separated by spaces or commas.

ResourceOperationsAPI area
DocktixCRM.modulesREAD CREATE UPDATE DELETE EXECUTEModules
DocktixCRM.recordsREAD CREATE UPDATE DELETERecords
DocktixDrive.resourcesREAD CREATE UPDATE DELETEDrive
DocktixSign.signaturesREAD CREATE UPDATE EXECUTEE-signatures
DocktixFirm.firmsREAD UPDATEFirm, users and audits
DocktixFirm.usersREAD CREATE UPDATE DELETEFirm, users and audits
DocktixFirm.profilesREAD CREATE UPDATE DELETEFirm, users and audits
DocktixFirm.auditsREADFirm, users and audits
DocktixWriter.documentsREAD CREATE UPDATE DELETE EXECUTEWriter
DocktixWriter.templatesREAD CREATE UPDATE DELETEWriter
DocktixFirm.tagsREAD CREATE UPDATE DELETETags
  • A token only gets scopes that are inside your client's allowed scopes. A refresh can narrow the scopes, never widen them.
  • Scopes are fixed when a token is issued. After adding a scope to a client, request a new token.
  • Holding a scope is necessary but not always sufficient. The user the token acts as must also hold the matching permission in Docktix (for example, only Owners and Administrators can change firm settings).
  • Request the minimum scopes. Prefer …READ over …ALL.

7. Code samples

Node.js (18+)

js
const API = "https://doc-management.docktix.com";
let cached = { token: null, expiresAt: 0 };

async function getToken() {
  if (cached.token && Date.now() < cached.expiresAt - 60_000) return cached.token;
  const res = await fetch(`${API}/api/v1/oauth/v2/token`, {
    method: "POST",
    headers: {
      Authorization: "Basic " + Buffer.from(`${process.env.DOCKTIX_CLIENT_ID}:${process.env.DOCKTIX_CLIENT_SECRET}`).toString("base64"),
      "Content-Type": "application/x-www-form-urlencoded",
    },
    body: new URLSearchParams({ grant_type: "client_credentials", scope: "DocktixCRM.records.READ" }),
  });
  if (!res.ok) throw new Error(`token request failed: ${res.status}`);
  const body = await res.json();
  cached = { token: body.access_token, expiresAt: Date.now() + body.expires_in * 1000 };
  return cached.token;
}

async function docktix(path, body = {}, retried = false) {
  const res = await fetch(`${API}/docktix/api/v1/${path}`, {
    method: "POST",
    headers: { Authorization: `Bearer ${await getToken()}`, "Content-Type": "application/json" },
    body: JSON.stringify(body),
  });
  if (res.status === 401 && !retried) { cached = { token: null, expiresAt: 0 }; return docktix(path, body, true); }
  return res.json();
}

console.log(await docktix("records/list", { Firm_Id: process.env.DOCKTIX_FIRM_ID, Email: process.env.DOCKTIX_USER_EMAIL, Module_Api: "contacts", Page: 1, Per_Page: 25 }));

Python

python
import os, time, requests

API = "https://doc-management.docktix.com"
_tok = {"value": None, "exp": 0}

def token():
    if _tok["value"] and time.time() < _tok["exp"] - 60:
        return _tok["value"]
    r = requests.post(f"{API}/api/v1/oauth/v2/token",
                      auth=(os.environ["DOCKTIX_CLIENT_ID"], os.environ["DOCKTIX_CLIENT_SECRET"]),
                      data={"grant_type": "client_credentials", "scope": "DocktixCRM.records.READ"}, timeout=30)
    r.raise_for_status()
    j = r.json()
    _tok.update(value=j["access_token"], exp=time.time() + j["expires_in"])
    return _tok["value"]

def docktix(path, body=None):
    r = requests.post(f"{API}/docktix/api/v1/{path}", json=body or {},
                      headers={"Authorization": f"Bearer {token()}"}, timeout=60)
    return r.json()

print(docktix("records/list", {"Firm_Id": os.environ["DOCKTIX_FIRM_ID"], "Email": os.environ["DOCKTIX_USER_EMAIL"], "Module_Api": "contacts", "Page": 1, "Per_Page": 25}))

C# (.NET 8)

csharp
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;

var http = new HttpClient { BaseAddress = new Uri("https://doc-management.docktix.com/") };

var basic = Convert.ToBase64String(Encoding.UTF8.GetBytes(
    $"{Environment.GetEnvironmentVariable("DOCKTIX_CLIENT_ID")}:{Environment.GetEnvironmentVariable("DOCKTIX_CLIENT_SECRET")}"));
var tokenReq = new HttpRequestMessage(HttpMethod.Post, "api/v1/oauth/v2/token")
{
    Headers = { Authorization = new AuthenticationHeaderValue("Basic", basic) },
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        ["grant_type"] = "client_credentials",
        ["scope"] = "DocktixCRM.records.READ"
    })
};
var tokenRes = await http.SendAsync(tokenReq);
tokenRes.EnsureSuccessStatusCode();
var accessToken = (await tokenRes.Content.ReadFromJsonAsync<System.Text.Json.JsonElement>()).GetProperty("access_token").GetString();

var call = new HttpRequestMessage(HttpMethod.Post, "docktix/api/v1/records/list")
{
    Headers = { Authorization = new AuthenticationHeaderValue("Bearer", accessToken) },
    Content = JsonContent.Create(new { Firm_Id = Environment.GetEnvironmentVariable("DOCKTIX_FIRM_ID"), Email = Environment.GetEnvironmentVariable("DOCKTIX_USER_EMAIL"), Module_Api = "contacts", Page = 1, Per_Page = 25 })
};
Console.WriteLine(await (await http.SendAsync(call)).Content.ReadAsStringAsync());

Postman

  1. Collection → Authorization → OAuth 2.0 → grant type Client Credentials.
  2. Access Token URL: https://doc-management.docktix.com/api/v1/oauth/v2/token. Enter Client ID, Client Secret and the scopes (space-separated). Set client authentication to Send as Basic Auth header.
  3. Click Get New Access Token, then Use Token.
  4. Store the secret in a secret environment variable, never in the collection itself.

8. Limits

ItemValue
Access token lifetime3600 seconds
Self Client code validity1–10 minutes, single use
Access tokens per refresh token10 per 10 minutes
Failed client authentications at the token endpoint30 per IP per 10 minutes
Token request size16 KB
List page sizedefault 25, maximum 100
Revocation takes effectwithin about 1 minute

9. Security checklist

  • Never put the Client Secret or a refresh token in a browser, a mobile app or a source repository.
  • Use one client per integration so you can revoke one without affecting the others.
  • Request only the scopes you need.
  • Reuse an access token until it is about to expire; do not request a token for every call.
  • If a secret may have leaked: rotate it in Settings → API Access with no grace period and revoke all tokens.
  • Always use HTTPS and never log the Authorization header.
  • On 401, get a new token once and retry. A 403 insufficient_scope is a configuration problem: do not retry.

10. Troubleshooting

SymptomCheck
401 invalid_client at the token endpointWrong Client ID or secret, the secret was rotated, or the client was deleted
400 invalid_grant for a codeThe code expired (1–10 minutes) or was already used. Generate a new one
400 invalid_scopeScope misspelled (case-sensitive) or not in the client's allowed scopes
401 missing_token and "unresolved variable"{{AccessToken}} was not replaced in Postman. Set the variable
401 missing_token and "not an access token"You sent something other than an OAuth access token
403 insufficient_scopeAdd the scope shown in Required_Scope to the client, then request a new token
401 token_revokedExpected after revoking or rotating with revocation. Request a new token
404 on every callAPI access may not be enabled for your account. Contact Docktix support
Writer or Tags calls failThese use editor_api_domain from the token response

Changelog

DateChange
2026-11-17First public release.