API Documentation
The copyright.sh API enables AI companies to verify content licensing, process payments, and ensure compliance with creator rights. Our REST API uses JSON for requests and responses.
🚀 Quick Start Guide
- Sign up for an API key at copyright.sh/dashboard
- Install our SDK or use direct HTTP requests
- Check for
ai-license
meta tags before using content - Verify licensing and log usage through our API
Authentication
All API requests require authentication using Bearer tokens. Include your API key in the Authorization header.
curl -H "Authorization: Bearer sk_live_abc123..." \
https://api.copyright.sh/v1/verify-license
API Key Types
sk_test_
- Test environmentsk_live_
- Production environment
Verify License
POST
/v1/verify-license
Check if content is licensed and get pricing information.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Yes | URL of the content to verify |
tokens | integer | Yes | Number of tokens to be used |
purpose | string | No | training, inference, or analysis |
Example Request
{
"url": "https://example.com/article",
"tokens": 1500,
"purpose": "training"
}
Response
{
"licensed": true,
"rate": 0.05,
"cost": 0.075,
"currency": "EUR",
"license_id": "lic_abc123",
"creator": {
"name": "John Smith",
"verified": true
},
"terms_url": "https://copyright.sh/terms"
}
Log Usage
POST
/v1/log-usage
Record content usage and process payment.
{
"license_id": "lic_abc123",
"tokens_used": 1500,
"hmac_signature": "sha256=abc123...",
"timestamp": "2025-01-23T10:00:00Z"
}
HMAC Verification
All usage logging requires HMAC signatures for security and tamper-proofing.
Python Example
import hmac
import hashlib
import json
def create_hmac_signature(payload, secret_key):
message = json.dumps(payload, sort_keys=True)
signature = hmac.new(
secret_key.encode('utf-8'),
message.encode('utf-8'),
hashlib.sha256
).hexdigest()
return f"sha256={signature}"
# Usage
payload = {
"license_id": "lic_abc123",
"tokens_used": 1500,
"timestamp": "2025-01-23T10:00:00Z"
}
signature = create_hmac_signature(payload, "your_secret_key")
Python SDK
Installation
pip install copyright-sh
Usage
from copyright_sh import CopyrightClient
client = CopyrightClient(api_key="sk_live_abc123")
# Check if content is licensed
result = client.verify_license(
url="https://example.com/article",
tokens=1500
)
if result.licensed:
# Use the content
content = fetch_content(url)
# Log usage
client.log_usage(
license_id=result.license_id,
tokens_used=1500
)
Error Handling
The API returns standard HTTP status codes and detailed error messages.
Status Code | Description |
---|---|
200 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
403 | Forbidden - Content not licensed |
429 | Rate limit exceeded |
500 | Internal server error |