Claw Protocol Specification

Version 0.1 · Draft · March 2026

Author: ClawDrop


1. Introduction

The Claw Protocol defines a standard interface for programmatic file exchange. It is designed for AI agents, CLI tools, and automated systems that need to upload, retrieve, inspect, and delete files via simple HTTP operations.

Claw maps directly onto HTTP. Every Claw operation is a single HTTP request. Any HTTP client can speak Claw without specialized libraries.

1.1 Design Principles

  1. One operation, one request. No multi-step flows, no sessions, no state machines.
  2. HTTP is the transport. Claw is an application-layer convention over standard HTTP methods and headers.
  3. Programmatic first. The primary interface is CLI and code, not browsers. Browser rendering is content negotiation, not a separate product.
  4. No accounts. Identity is an API key. There are no usernames, passwords, profiles, or sessions.
  5. Ephemeral by default. Files expire unless explicitly made permanent by an authenticated client.

1.2 Terminology

TermDefinition
RegistryA Claw-compatible server (e.g., clawdrop.io)
SlugA short, unique identifier for an uploaded file
NamespaceAn optional @name prefix for organizing files under an API key
DropThe act of uploading a file to a registry
FetchThe act of downloading a file from a registry

2. URI Scheme

Claw defines the claw:// URI scheme as syntactic sugar over HTTPS:

claw://<slug>                    → https://<registry>/<slug>
claw://<slug>?raw                → https://<registry>/<slug>?raw
claw://<slug>?m                  → https://<registry>/<slug>?m
claw://sha256:<hash>             → https://<registry>/sha256/<hash>
claw://@<namespace>/<name>       → https://<registry>/@<namespace>/<name>

The default registry is clawdrop.io. Clients MAY configure an alternative registry.


3. Operations

3.1 Drop (Upload)

Upload a file to the registry.

POST /
Content-Type: multipart/form-data

Form field: file (required)

Request Headers

HeaderRequiredDescription
Content-TypeYesMust be multipart/form-data
X-API-KeyNoAPI key for authenticated uploads
Max-DaysNoExpiration in days (1–90, default 7). permanent with API key.
AcceptNoapplication/json for structured response
X-Content-AddressNotrue to enable content-addressable mode
X-SlugNoCustom slug (requires API key, 3–64 chars, alphanumeric + hyphens)
X-NamespaceNoNamespace prefix (requires API key)

Response (text/plain, default)

https://registry/slug\n

Response (application/json)

json
{
  "url": "https://registry/slug",
  "slug": "a3Fk82xQ",
  "expires_at": "2026-03-16T00:00:00.000Z",
  "size_bytes": 45231,
  "content_type": "application/pdf",
  "sha256_hash": "abc123..."
}

Status Codes

CodeMeaning
200Upload successful
400Missing file, empty file, or invalid parameters
409Custom slug already taken
413File exceeds size limit
429Rate limit exceeded
451Content blocked
502Storage unavailable

3.2 Fetch (Download)

Retrieve a file from the registry.

GET /<slug>
GET /<slug>?raw
GET /@<namespace>/<slug>
GET /sha256/<hash>

Content Negotiation

Response Headers

HeaderDescription
Content-TypeMIME type of the file
Content-LengthFile size in bytes
Content-Dispositioninline or attachment (dangerous types forced to attachment)
ETagSHA-256 hash of content
Cache-Controlpublic, max-age=86400

Status Codes

CodeMeaning
200File served
301Redirect (content-addressable lookups)
404File not found
410File expired

3.3 Inspect (Metadata)

Retrieve metadata about a file without downloading it.

GET /<slug>?m

Response

json
{
  "slug": "a3Fk82xQ",
  "filename": "report.pdf",
  "content_type": "application/pdf",
  "size_bytes": 45231,
  "sha256_hash": "abc123...",
  "expires_at": "2026-03-16T00:00:00.000Z",
  "created_at": "2026-03-09T00:00:00.000Z",
  "permanent": false
}

3.4 Delete

Remove a file. Requires the same API key used to upload it.

DELETE /<slug>
X-API-Key: claw_...

Status Codes

CodeMeaning
204Deleted
401Missing or invalid API key
403API key does not match upload owner
404File not found

4. Authentication

4.1 API Keys

API keys are the sole authentication mechanism. There are no usernames, passwords, or OAuth flows.

Key Generation

POST /keys

Returns a new API key exactly once. The server stores only the SHA-256 hash.

Key Format: claw_ prefix + 32 cryptographically random base62 characters.

Example: claw_a7Kx9mP2rN4wQ8bF3vT6yJ1hD5sL0gC

Key Usage: Pass via the X-API-Key header on any request.

4.2 Key Introspection

GET /keys/me
X-API-Key: claw_...

Returns upload history and usage statistics for the authenticated key.

json
{
  "uploads": [
    {"slug": "a3Fk82xQ", "filename": "report.pdf", "created_at": "...", "expires_at": "..."}
  ],
  "usage": {
    "upload_count": 47,
    "bytes_stored": 125829120,
    "bytes_served": 524288000
  },
  "namespace": "@myproject"
}

5. Rate Limiting

Rate limits are communicated via standard headers on every response:

HeaderDescription
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRequests remaining in current window
Retry-AfterSeconds to wait (only on 429 responses)

Default Limits

TierLimit
Free (anonymous)60 requests/hour
Pro600 requests/hour
Studio6,000 requests/hour

6. Content-Addressable Mode

When X-Content-Address: true is sent with an upload:

  1. The server computes the SHA-256 hash of the content.
  2. If a file with that hash already exists and has not expired, the server returns the existing URL (HTTP 200, not 201).
  3. If no match exists, normal upload proceeds and a content:{hash} index is stored.

Lookup by Hash

GET /sha256/<hash>

Returns HTTP 301 redirect to the canonical slug URL. This enables deduplication and convergent file references across independent agents.


7. Namespaces

Namespaces provide URL grouping under an API key.

Claiming a namespace: Send X-Namespace: myproject on any upload with an API key. The namespace is claimed on first use and bound to that API key.

Namespace URLs: https://registry/@myproject/filename

Rules


8. Permanence

By default, all files are ephemeral with a 7-day TTL (free tier).

To create a permanent file, send Max-Days: permanent with a valid API key on a Pro or Studio tier.

Permanent files:


9. Error Codes

All errors return JSON:

json
{
  "error": "Human-readable message",
  "retry_after": 3600
}
HTTP StatusClaw Meaning
400Bad request (missing file, invalid parameters)
401Authentication required
403Forbidden (wrong API key for resource)
404Resource not found
409Conflict (slug taken)
410Gone (file expired)
413Payload too large
429Rate limit exceeded
451Content blocked
500Internal server error
502Storage unavailable

10. Conformance

A Claw-compatible server MUST implement:

  1. POST / file upload with multipart/form-data
  2. GET /<slug> file retrieval
  3. Content-Type preservation
  4. Expiration semantics (files MUST eventually expire unless permanent)
  5. SHA-256 content hashing
  6. Rate limiting headers

A Claw-compatible server SHOULD implement:

  1. API key authentication (POST /keys, X-API-Key header)
  2. Content negotiation (browser vs programmatic)
  3. Content-addressable mode
  4. Namespaces
  5. The ?m metadata endpoint
  6. The ?raw bypass

Appendix A: Quick Reference

bash
# Upload a file
$ curl -F "[email protected]" https://clawdrop.io

# Upload with API key and custom expiration
$ curl -F "[email protected]" -H "X-API-Key: claw_..." -H "Max-Days: 30" https://clawdrop.io

# Upload permanent file
$ curl -F "[email protected]" -H "X-API-Key: claw_..." -H "Max-Days: permanent" https://clawdrop.io

# Get JSON response
$ curl -F "[email protected]" -H "Accept: application/json" https://clawdrop.io

# Download a file
$ curl https://clawdrop.io/a3Fk82xQ -o report.pdf

# Inspect metadata
$ curl https://clawdrop.io/a3Fk82xQ?m

# Delete a file
$ curl -X DELETE -H "X-API-Key: claw_..." https://clawdrop.io/a3Fk82xQ

# Generate API key
$ curl -X POST https://clawdrop.io/keys

# Check usage
$ curl -H "X-API-Key: claw_..." https://clawdrop.io/keys/me

# Content-addressable upload
$ curl -F "[email protected]" -H "X-Content-Address: true" https://clawdrop.io

# Custom slug
$ curl -F "[email protected]" -H "X-API-Key: claw_..." -H "X-Slug: brand-logo" https://clawdrop.io

# Namespaced upload
$ curl -F "[email protected]" -H "X-API-Key: claw_..." -H "X-Namespace: myproject" https://clawdrop.io

The Claw Protocol is open. This spec is public. Fork it if we disappear.