API Documentation
Authentication
The FreeDOI API uses token-based authentication. You need to include your API token in the header of each request.
Authorization: Token YOUR_API_TOKEN
You can generate or view your API token in your account settings.
API Endpoints
GET
/api/suffixes/
List all suffixes owned by the authenticated user.
GET
/api/suffixes/{id}/
Get details of a specific suffix.
GET
/api/identifiers/
List all identifiers owned by the authenticated user.
GET
/api/identifiers/{id}/
Get details of a specific identifier.
POST
/api/identifiers/create/
Create a new identifier.
PUT
/api/identifiers/{id}/update/
Update an existing identifier.
Managing Suffixes
List Your Suffixes
GET /api/suffixes/
Example Response
{
"count": 1,
"results": [
{
"id": 1,
"name": "My Research Group",
"suffix": "1234",
"prefix": 1,
"description": "Suffix for our research group publications",
"approved": true,
"type": "local",
"remote_resolver": null
}
]
}
Get Suffix Details
GET /api/suffixes/{id}/
Managing Identifiers
Create an Identifier
POST /api/identifiers/create/
Content-Type: application/json
{
"suffix": 1,
"identifier": "my-paper-2024",
"target_url": "https://example.com/papers/my-paper-2024.pdf"
}
Update an Identifier
PUT /api/identifiers/{id}/update/
Content-Type: application/json
{
"suffix": 1,
"identifier": "my-paper-2024",
"target_url": "https://new-location.com/papers/my-paper-2024.pdf"
}
Usage Examples
For complete code examples in various programming languages, visit the Code Examples page.
Python Example
import requests
API_TOKEN = 'your_api_token'
BASE_URL = 'https://freedoi.org/api'
headers = {
'Authorization': f'Token {API_TOKEN}',
'Content-Type': 'application/json'
}
# List your suffixes
response = requests.get(f'{BASE_URL}/suffixes/', headers=headers)
print(response.json())
# Create a new identifier
data = {
'suffix': 1, # ID of your suffix
'identifier': 'my-new-paper',
'target_url': 'https://example.com/papers/my-new-paper.pdf'
}
response = requests.post(f'{BASE_URL}/identifiers/create/', json=data, headers=headers)
print(response.json())