Loading...

API Documentation

Integrate XDocument into your application with our simple REST API

Authentication

All API requests require an API key passed in the header:

X-API-Key: your-api-key-here

Base URL

https://api.xdocument.app/v1
POST

/files/upload

Upload a new file

Request

curl -X POST https://api.xdocument.app/v1/files/upload \
  -H "X-API-Key: your-api-key" \
  -F "file=@document.pdf"

Response

{
  "id": "clx1234567890",
  "filename": "document.pdf",
  "originalName": "document.pdf",
  "mimeType": "application/pdf",
  "size": 102400,
  "url": "/f/clx1234567890",
  "createdAt": "2024-01-15T10:30:00Z"
}
GET

/files/:id

Get file metadata

Request

curl https://api.xdocument.app/v1/files/clx1234567890 \
  -H "X-API-Key: your-api-key"
GET

/files/:id/download

Download file content

Request

curl https://api.xdocument.app/v1/files/clx1234567890/download \
  -H "X-API-Key: your-api-key" \
  -o document.pdf
DELETE

/files/:id

Delete a file

Request

curl -X DELETE https://api.xdocument.app/v1/files/clx1234567890 \
  -H "X-API-Key: your-api-key"
GET

/files

List all files with pagination

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
limit integer Items per page (default: 10, max: 100)
mimeType string Filter by MIME type

Error Codes

Code Description
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
404 Not Found - File doesn't exist
429 Too Many Requests - Rate limit exceeded
500 Server Error - Something went wrong
Need an API key? Contact us to get started.