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 URL | https://doc-management.docktix.com |
| Token endpoint | POST https://doc-management.docktix.com/api/v1/oauth/v2/token |
| Request path prefix | /docktix/api/v1/ |
| Access token | JWT, lifetime 3600 seconds (1 hour) |
| Grant types | authorization_code (Self Client), client_credentials (Server-based), refresh_token |
| Request / response format | JSON. API calls are an HTTP POST whose body includes Firm_Id and Email (parameter-less reads are GET). |
The token response contains
api_domainandeditor_api_domain. Useapi_domainfor most calls andeditor_api_domainfor the Writer (documents, templates) and Tags calls. Always take these values from the token response instead of hard-coding them.
1. How it works
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 oneThe 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
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"{
"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
}# 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.
| Field | Description |
|---|---|
| Client name | A label for your integration. |
| Client type | Self Client or Server-based (see below). |
| Redirect URIs | Server-based only: 1–10 absolute https URLs (http is allowed for localhost). No fragments. |
| Allowed scopes | The 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 Client | Server-based | |
|---|---|---|
| Best for | Scripts and one-off integrations | Long-running back-end services |
| How you get a token | An administrator generates a code in Docktix; you exchange it once | client_credentials with Client ID + Client Secret |
| Refresh token | Yes | No: request a new access token when it expires |
| Acts as | The administrator who generated the code | The 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 withclient_idandclient_secretin the body. If both are sent, Basic wins. - Body:
application/x-www-form-urlencodedor 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.
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"{
"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
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
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
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": "..." }.
| HTTP | error | Meaning |
|---|---|---|
| 400 | invalid_request | A required parameter is missing, or the body is malformed or too large |
| 400 | unsupported_grant_type | Use authorization_code, refresh_token or client_credentials |
| 401 | invalid_client | Unknown client, wrong secret, or the client was revoked |
| 400 | invalid_grant | Code invalid, expired or already used; refresh token invalid or revoked |
| 400 | invalid_scope | Unknown scope, or wider than your client / grant allows |
| 400 | unauthorized_client | client_credentials used with a Self Client |
| 429 | rate_limited | Too many refreshes, or too many failed authentication attempts from your IP (30 per 10 minutes) |
| 500 | server_error | Temporary 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:
Authorization: Bearer 1000.eyJhbGciOiJSUzI1NiIs…
Authorization: Docktix-oauthtoken 1000.eyJhbGciOiJSUzI1NiIs…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
POSTwith a JSON body that always includesFirm_IdandEmail. The five reads that take no parameters (modules/list,drive/resources/list,firm/details,users/list,profiles/list) areGETwith no body. Firm_IdandEmailin everyPOSTbody 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:
200success,202accepted (pending approval),400invalid request,401/403authorization problem,404not found,409conflict,5xxserver problem. - Success envelope:
{ "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 answers404 … 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": truein 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.
| HTTP | Error | Cause and fix |
|---|---|---|
| 401 | missing_token | No or malformed Authorization header, an unreplaced {{variable}}, or a token that is not an API access token |
| 401 | token_expired | The token expired. Refresh it or request a new one |
| 401 | invalid_token | The token is not valid. Request a new one |
| 401 | token_revoked | The token or its client was revoked. Request a new one |
| 403 | insufficient_scope | The route needs Required_Scope. Add it to the client, then request a new token |
| 403 | tenant_mismatch, not_a_member | The token's user no longer has access to this firm |
| 404 | none | The object does not exist in your firm, or API access is not enabled for your account |
| 503 | none | Temporary 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.
| Resource | Operations | API area |
|---|---|---|
DocktixCRM.modules | READ CREATE UPDATE DELETE EXECUTE | Modules |
DocktixCRM.records | READ CREATE UPDATE DELETE | Records |
DocktixDrive.resources | READ CREATE UPDATE DELETE | Drive |
DocktixSign.signatures | READ CREATE UPDATE EXECUTE | E-signatures |
DocktixFirm.firms | READ UPDATE | Firm, users and audits |
DocktixFirm.users | READ CREATE UPDATE DELETE | Firm, users and audits |
DocktixFirm.profiles | READ CREATE UPDATE DELETE | Firm, users and audits |
DocktixFirm.audits | READ | Firm, users and audits |
DocktixWriter.documents | READ CREATE UPDATE DELETE EXECUTE | Writer |
DocktixWriter.templates | READ CREATE UPDATE DELETE | Writer |
DocktixFirm.tags | READ CREATE UPDATE DELETE | Tags |
- 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
…READover…ALL.
7. Code samples
Node.js (18+)
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
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)
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
- Collection → Authorization → OAuth 2.0 → grant type Client Credentials.
- 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. - Click Get New Access Token, then Use Token.
- Store the secret in a secret environment variable, never in the collection itself.
8. Limits
| Item | Value |
|---|---|
| Access token lifetime | 3600 seconds |
| Self Client code validity | 1–10 minutes, single use |
| Access tokens per refresh token | 10 per 10 minutes |
| Failed client authentications at the token endpoint | 30 per IP per 10 minutes |
| Token request size | 16 KB |
| List page size | default 25, maximum 100 |
| Revocation takes effect | within 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
Authorizationheader. - On
401, get a new token once and retry. A403 insufficient_scopeis a configuration problem: do not retry.
10. Troubleshooting
| Symptom | Check |
|---|---|
401 invalid_client at the token endpoint | Wrong Client ID or secret, the secret was rotated, or the client was deleted |
400 invalid_grant for a code | The code expired (1–10 minutes) or was already used. Generate a new one |
400 invalid_scope | Scope 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_scope | Add the scope shown in Required_Scope to the client, then request a new token |
401 token_revoked | Expected after revoking or rotating with revocation. Request a new token |
404 on every call | API access may not be enabled for your account. Contact Docktix support |
| Writer or Tags calls fail | These use editor_api_domain from the token response |
Changelog
| Date | Change |
|---|---|
| 2026-11-17 | First public release. |