Skip to content

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:

Base URL ​

All API requests are made to:

https://api.0.link/api

Authentication ​

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Test Connection ​

Let's start with a simple ping to test your connection:

Using curl ​

bash
curl -H "Authorization: Bearer 0link_sk_your_api_key_here" \
     https://api.0.link/api/ping

Using JavaScript (fetch) ​

javascript
const response = await fetch('https://api.0.link/api/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) ​

python
import requests

headers = {
    'Authorization': 'Bearer 0link_sk_your_api_key_here',
    'Content-Type': 'application/json'
}

response = requests.get('https://api.0.link/api/ping', headers=headers)
data = response.json()
print(data)

Expected Response ​

json
{
  "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 ​

bash
curl -H "Authorization: Bearer 0link_sk_your_api_key_here" \
     https://api.0.link/api/account

Response ​

json
{
  "id": "acc_1234567890",
  "email": "[email protected]",
  "name": "John Developer",
  "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 ​

bash
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.0.link/api/projects

Response ​

json
{
  "id": "proj_9876543210",
  "name": "My First Project",
  "description": "Getting started with 0.link",
  "status": "active",
  "created_at": "2024-01-15T10:30:00Z",
  "api_endpoints": {
    "integrations": "https://api.0.link/api/projects/proj_9876543210/integrations"
  }
}

Common Response Patterns ​

Success Response ​

All successful responses include:

json
{
  "status": "success",
  "data": { /* response data */ },
  "timestamp": "2024-01-15T10:30:00Z"
}

Error Response ​

All error responses include:

json
{
  "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 ​

javascript
import { ZeroLink } from '@0link/sdk';

const client = new ZeroLink({
  apiKey: 'your_api_key_here'
});

const ping = await client.ping();
console.log(ping);

Python ​

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. The default rate limit is 60 requests per minute for standard endpoints.

Rate limit headers are included in responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1642248000

Next Steps ​

Great job! You've made your first API calls. Here's what to do next:

  1. Understand API Access - Learn about permissions and security
  2. Explore API Reference - Dive deeper into all available endpoints

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

429 Rate Limit Exceeded ​

  • Slow down your request rate
  • Implement exponential backoff

Connection Issues ​

  • Verify your internet connection
  • Try from a different network if possible

Getting Help ​

Need assistance with your first API call?

Successfully made your first call? You're ready to build something amazing! 🚀