API Reference

GateDocs API

REST API for GateDocs — secure document sharing with built-in lead capture and analytics.

Authentication

All requests require a Bearer token in the Authorization header:

Authorization: Bearer gd_live_<token>

Create tokens in Settings > API, or via POST /tokens.

Rate limiting

  • Business: 1,000 requests/minute
  • Enterprise: 5,000 requests/minute

Rate limit headers are included on every response:

  • X-RateLimit-Limit — max requests per window
  • X-RateLimit-Remaining — remaining requests
  • X-RateLimit-Reset — Unix timestamp when window resets

Files

Upload, manage, and share files

GET/files

List files

Returns a paginated list of files for the authenticated organisation. Supports filtering by folder and active status, with sorting options.

Parameters

  • pagequeryPage number (1-based)
  • per_pagequeryItems per page (max 100)
  • folder_idqueryFilter files by folder ID
  • is_activequeryFilter by active status
  • sortquerySort field
  • orderquerySort order

Responses

  • 200 — Paginated list of files
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/files

Create a file record

Creates a new file record with the specified metadata and protection settings. The file must be uploaded separately to Supabase Storage.

Body FileCreate

Responses

  • 201 — File created
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/files/{id}

Get file details

Returns a single file with view count and lead count.

Parameters

  • idpath, requiredFile ID

Responses

  • 200 — File details
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
PATCH/files/{id}

Update a file

Updates file metadata and protection settings. All fields are optional.

Body FileUpdate

Parameters

  • idpath, requiredFile ID

Responses

  • 200 — File updated
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
DELETE/files/{id}

Delete a file

Soft-deletes a file by setting `deleted_at` and `is_active` to false. The file can be restored from trash.

Parameters

  • idpath, requiredFile ID

Responses

  • 204 — File deleted
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/files/starred

List starred file IDs

Returns an array of file IDs that the authenticated user has starred.

Responses

  • 200 — Array of starred file IDs
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/files/{id}/star

Star a file

Adds the file to the authenticated user's starred list. Returns 409 if already starred.

Parameters

  • idpath, requiredFile ID

Responses

  • 201 — File starred
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 409 — File is already starred
  • 429 — Rate limit exceeded
  • 500 — Internal server error
DELETE/files/{id}/star

Unstar a file

Removes the file from the authenticated user's starred list.

Parameters

  • idpath, requiredFile ID

Responses

  • 204 — File unstarred
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/files/{id}/restore

Restore a soft-deleted file

Restores a file from trash by clearing `deleted_at` and setting `is_active` to true.

Parameters

  • idpath, requiredFile ID

Responses

  • 204 — File restored
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/files/{id}/download-url

Get a signed download URL

Returns a signed URL for downloading the file. The URL expires after 5 minutes (300 seconds).

Parameters

  • idpath, requiredFile ID

Responses

  • 200 — Signed download URL
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Folders

Organise files into folders

GET/folders

List folders

Returns all folders for the authenticated organisation, each with a file count.

Responses

  • 200 — List of folders
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/folders

Create a folder

Creates a new folder. The slug is auto-generated from the name.

Body FolderCreate

Responses

  • 201 — Folder created
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/folders/{id}

Get folder details

Returns a single folder with its file count.

Parameters

  • idpath, requiredFolder ID

Responses

  • 200 — Folder details
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
PATCH/folders/{id}

Update a folder

Updates folder name, description, or visibility. At least one field is required.

Body FolderUpdate

Parameters

  • idpath, requiredFolder ID

Responses

  • 200 — Folder updated
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
DELETE/folders/{id}

Delete a folder

Permanently deletes a folder. Files in the folder are unlinked (moved to root), not deleted.

Parameters

  • idpath, requiredFolder ID

Responses

  • 204 — Folder deleted
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Leads

View and export captured leads

GET/files/{id}/leads

List leads for a file

Returns a paginated list of leads captured for a specific file.

Parameters

  • idpath, requiredFile ID
  • pagequeryPage number (1-based)
  • per_pagequeryItems per page (max 100)

Responses

  • 200 — Paginated list of leads
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/leads

List leads

Returns a paginated list of all leads across the organisation. Optionally filter by file ID.

Parameters

  • pagequeryPage number (1-based)
  • per_pagequeryItems per page (max 100)
  • file_idqueryFilter leads by file ID

Responses

  • 200 — Paginated list of leads
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
DELETE/leads/{id}

Delete a lead

Permanently deletes a lead record.

Parameters

  • idpath, requiredLead ID

Responses

  • 204 — Lead deleted
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/leads/export

Export leads as CSV

Downloads all leads as a CSV file. Limited to 10,000 records per export.

Responses

  • 200 — CSV file download
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Analytics

View counts, lead stats, and trends

GET/analytics/overview

Get analytics overview

Returns aggregate statistics for the entire organisation.

Responses

  • 200 — Organisation-wide analytics
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/analytics/files/{id}

Get file analytics

Returns detailed analytics for a specific file, including views by date.

Parameters

  • idpath, requiredFile ID

Responses

  • 200 — File analytics
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/analytics/views

Get views time series

Returns view counts aggregated by date for a given period. Optionally filter to a specific file.

Parameters

  • periodqueryTime period for the data
  • file_idqueryFilter to a specific file

Responses

  • 200 — Views time series
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/analytics/top-files

Top files by views

Returns the top N files ranked by total views. Useful for identifying the most popular content.

Parameters

  • limitqueryNumber of files to return (max 20)

Responses

  • 200 — Top files by view count
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/analytics/activity

Recent team upload activity

Returns a summary of recent upload activity grouped by team member.

Responses

  • 200 — Team upload activity
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Team

List team members and their activity

GET/team

List team members

Returns all members of the authenticated organisation.

Responses

  • 200 — List of team members
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/team/invite

Invite a member by email

Sends an invitation to join the organisation. The invitee receives an email with a magic link. Defaults to the `member` role if not specified.

Body InviteMember

Responses

  • 201 — Invitation sent
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
GET/team/{userId}/stats

Get team member stats

Returns activity statistics for a specific team member.

Parameters

  • userIdpath, requiredUser ID

Responses

  • 200 — Member statistics
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Organisation

Organisation settings and configuration

GET/org

Get organisation settings

Returns the full organisation object for the authenticated team.

Responses

  • 200 — Organisation settings
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
PATCH/org

Update organisation settings

Updates organisation settings such as name and brand colour. At least one field is required.

Body OrgUpdate

Responses

  • 200 — Organisation updated
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error

Tokens

Manage API tokens programmatically

GET/tokens

List API tokens

Returns all API tokens for the organisation. Token hashes are never exposed — only the prefix is shown.

Responses

  • 200 — List of tokens
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
POST/tokens

Create an API token

Creates a new API token. The full token value is returned **only once** in the response — store it securely, as it cannot be retrieved again.

Body TokenCreate

Responses

  • 201 — Token created (full token shown once)
  • 400 — Validation error
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 429 — Rate limit exceeded
  • 500 — Internal server error
DELETE/tokens/{id}

Revoke an API token

Soft-revokes a token by setting `revoked_at`. Returns 409 if the token is already revoked.

Parameters

  • idpath, requiredToken ID

Responses

  • 204 — Token revoked
  • 401 — Missing or invalid API token
  • 403 — Insufficient permissions or organisation suspended
  • 404 — Resource not found
  • 409 — Token already revoked
  • 429 — Rate limit exceeded
  • 500 — Internal server error