Skip to main content

Authenticating with DataDocks API

Before making API calls to DataDocks, you'll need to authenticate your requests using an API token. This page will guide you through the authentication process with clear examples.

Getting Your API Token

Your API token is unique to your organization and serves as your digital key to the DataDocks API. To obtain your token:

  1. Contact the DataDocks support team at support@datadocks.com
  2. Provide your organization name and the subdomain of your location
  3. Our team will generate an API user and provide you with an API token

Important: Keep your API token secure! Do not share it in public repositories or client-side code.

Using Your API Token

Include your API token in the Authorization header of all requests as a Token:

Authorization: Token YOUR_API_TOKEN

Request Format

All API requests must include:

  1. The Authorization header with your token
  2. Your location subdomain in the URL
  3. The appropriate HTTP method (GET, POST, PUT, etc.)
  4. Content-Type header (for POST/PUT requests)

Authentication Examples

cURL Example

See cURL example
# Get all appointments
curl -H "Authorization: Token 12345abcde" https://toronto-acme.datadocks.com/api/v1/appointments

# Create a new appointment
curl -H "Authorization: Token 12345abcde" \
-H "Content-Type: application/json" \
-X POST \
-d '{"appointment": {"scheduled_at": "2023-10-01T09:00:00-04:00", "duration": 60}}' \
https://toronto-acme.datadocks.com/api/v1/appointments

JavaScript Example

See JavaScript example
// Using fetch API
const fetchAppointments = async () => {
const response = await fetch(
"https://toronto-acme.datadocks.com/api/v1/appointments",
{
method: "GET",
headers: {
Authorization: "Token 12345abcde",
"Content-Type": "application/json",
},
}
);

const data = await response.json();
return data;
};

Python Example

See Python example
import requests

# Configuration
api_token = '12345abcde'
location_subdomain = 'toronto-acme'

# Get all appointments
headers = {
'Authorization': f'Token {api_token}',
'Content-Type': 'application/json'
}

response = requests.get(
f'https://{location_subdomain}.datadocks.com/api/v1/appointments',
headers=headers
)

appointments = response.json()

Security Best Practices

When working with the DataDocks API, follow these security best practices:

  1. Store tokens securely — Never hard-code tokens in client-side code or public repositories
  2. Use environment variables — Store tokens in environment variables or secure credential stores
  3. Implement token rotation — Request a new token periodically (every 90 days)
  4. Apply the principle of least privilege — Only request the permissions you need
  5. Monitor token usage — Regularly review API logs for unusual activity

Troubleshooting Authentication

ErrorPossible CauseSolution
401 UnauthorizedInvalid or missing tokenVerify your token is correct and properly formatted in the header
403 ForbiddenToken doesn't have permissionContact support to ensure your token has the necessary permissions
429 Too Many RequestsRate limit exceededImplement exponential backoff strategy

If you continue to experience authentication issues, contact support@datadocks.com with details of your request and the error response.