Every resource in pdrive has a JSON representation. Append .json to any GET URL and you get structured data instead of HTML. No special headers required. See the full API reference for details.
Resource IDs in responses are prefixed and checksummed (e.g. doc_V1StGXR8Z5jdHi6BmyT0xq3k9fK2 for a document), so you can tell at a glance what type of resource you're looking at. Treat them as opaque strings in your client code.
Quick start
Publish a document with a single curl command:
curl -X PUT https://pdrive.io/api/acme/docs/getting-started.md \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "# Getting started\n\nWelcome to pdrive."}'
Read it back as JSON:
curl https://pdrive.io/acme/docs/getting-started.md.json
URL patterns
| Resource | JSON URL |
|---|---|
| Account projects | /:account.json |
| Project documents | /:account/:project.json |
| Document list | /:account/:project/-/documents.json |
| Document (latest) | /:account/:project/:filename.json |
| Version history | /:account/:project/:filename/versions.json |
| Specific version | /:account/:project/:filename/versions/:n.json |
API endpoints
| Operation | Method | URL |
|---|---|---|
| Create document | POST | /api/:account/:project/:filename |
| Create or update | PUT | /api/:account/:project/:filename |
| Rename/move/update | PATCH | /api/:account/:project/:filename |
| Delete document | DELETE | /api/:account/:project/:filename |
| Create project | POST | /api/:account/-/projects |
| List projects | GET | /api/:account/-/projects |
| List documents | GET | /api/:account/:project/-/documents |
| Current user | GET | /api/me |
| Audit log | GET | /api/:account/-/audit-log |
Pagination
List endpoints return a standard envelope with cursor-based pagination:
{
"items": [...],
"next_cursor": "eyJpIj...",
"has_more": true
}
Pass ?cursor=<opaque>&limit=N to page through results. The default limit is 50 (max 200). When has_more is false, there are no more results.
API keys
Create API keys in your account settings. Each key has a scope:
- Read (
read) for fetching documents, listings, and version history - Read write (
read write) for uploading, updating, and managing documents
API keys authenticate via the Authorization: Bearer header. Admins can also manage keys via the API at /api/:account/-/api-keys.
What you can do
All CRUD operations are available through the API:
- Create, update, and delete documents with content
- List projects and documents with cursor-based pagination
- Read document content and metadata
- View version history and diffs
- Manage project settings and memberships
- Query the audit log
- Discover your identity via
/api/me
See the full API reference for details.
Rate limiting
API requests are rate limited based on your plan. If you exceed the limit, the API returns 429 Too Many Requests with a Retry-After header so you know how long to wait before retrying.