Your First API Call
Let's make your first API call to 0.link! This guide will walk you through testing your connection and understanding the basics of our API.
Prerequisites
Before making your first call, ensure you have:
- ✅ Created your account
- ✅ Generated an API key
- ✅ A way to make HTTP requests (curl, Postman, or code)
Base URL
All API requests are made to:
https://api.0link.com/v2Authentication
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYTest Connection
Let's start with a simple ping to test your connection:
Using curl
curl -H "Authorization: Bearer 0link_sk_your_api_key_here" \
https://api.0link.com/v2/pingUsing JavaScript (fetch)
const response = await fetch('https://api.0link.com/v2/ping', {
headers: {
'Authorization': 'Bearer 0link_sk_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Using Python (requests)
import requests
headers = {
'Authorization': 'Bearer 0link_sk_your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.get('https://api.0link.com/v2/ping', headers=headers)
data = response.json()
print(data)Expected Response
{
"status": "success",
"message": "pong",
"timestamp": "2024-01-15T10:30:00Z",
"version": "2.1.0"
}Get Account Information
Once ping works, let's get your account information:
Request
curl -H "Authorization: Bearer 0link_sk_your_api_key_here" \
https://api.0link.com/v2/accountResponse
{
"id": "acc_1234567890",
"email": "developer@example.com",
"name": "John Developer",
"plan": "free",
"usage": {
"current_month": 152,
"limit": 10000,
"reset_date": "2024-02-01T00:00:00Z"
},
"created_at": "2024-01-01T00:00:00Z"
}Create Your First Project
Projects help organize your integrations:
Request
curl -X POST \
-H "Authorization: Bearer 0link_sk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Project",
"description": "Getting started with 0.link"
}' \
https://api.0link.com/v2/projectsResponse
{
"id": "proj_9876543210",
"name": "My First Project",
"description": "Getting started with 0.link",
"status": "active",
"created_at": "2024-01-15T10:30:00Z",
"api_endpoints": {
"assets": "https://api.0link.com/v2/projects/proj_9876543210/assets",
"integrations": "https://api.0link.com/v2/projects/proj_9876543210/integrations",
"analytics": "https://api.0link.com/v2/projects/proj_9876543210/analytics"
}
}Upload Your First Asset
Let's upload a simple text file:
Request
curl -X POST \
-H "Authorization: Bearer 0link_sk_your_api_key_here" \
-F "file=@example.txt" \
-F "name=my-first-upload" \
https://api.0link.com/v2/projects/proj_9876543210/assetsResponse
{
"id": "asset_1111222233",
"name": "my-first-upload",
"filename": "example.txt",
"size": 1024,
"content_type": "text/plain",
"url": "https://cdn.0link.com/assets/asset_1111222233/example.txt",
"project_id": "proj_9876543210",
"created_at": "2024-01-15T10:35:00Z"
}Common Response Patterns
Success Response
All successful responses include:
{
"status": "success",
"data": { /* response data */ },
"timestamp": "2024-01-15T10:30:00Z"
}Error Response
All error responses include:
{
"status": "error",
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid",
"details": "Please check your API key and try again"
},
"timestamp": "2024-01-15T10:30:00Z"
}Testing Tools
Postman Collection
Import our Postman collection for easy testing: Download 0.link Postman Collection
API Explorer
Use our interactive API explorer in the dashboard: Dashboard API Explorer
SDK Quickstart
For faster development, use our official SDKs:
JavaScript/Node.js
import { ZeroLink } from '@0link/sdk';
const client = new ZeroLink({
apiKey: 'your_api_key_here'
});
const ping = await client.ping();
console.log(ping);Python
from zerolink import Client
client = Client(api_key='your_api_key_here')
ping = client.ping()
print(ping)Rate Limiting
Be aware of rate limits:
- Free Tier: 60 requests per minute
- Pro Plan: 600 requests per minute
- Enterprise: Custom limits
Rate limit headers are included in responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1642248000Next Steps
Great job! You've made your first API calls. Here's what to do next:
- Understand API Access - Learn about permissions and security
- Explore API Reference - Dive deeper into all available endpoints
- Choose an SDK - Speed up development with official libraries
- Integration Guides - Framework-specific tutorials
Troubleshooting
401 Unauthorized
- Verify your API key is correct
- Check that the key hasn't expired
- Ensure the key has the right permissions
403 Forbidden
- Check your account's usage limits
- Verify you have access to the requested resource
- Ensure your plan supports the feature
429 Rate Limit Exceeded
- Slow down your request rate
- Implement exponential backoff
- Consider upgrading your plan
Connection Issues
- Check the API status at status.0link.com
- Verify your internet connection
- Try from a different network if possible
Getting Help
Need assistance with your first API call?
- Documentation: Browse our API reference
- Examples: Check out more code examples
- Support: Email support@0link.com
- Community: Join our developer Discord
Successfully made your first call? You're ready to build something amazing! 🚀