Getting started overview
This guide provides a structured approach to initiating development with Clico, focusing on the essential steps from account creation to executing a foundational API request. Clico facilitates the creation and management of shortened URLs, custom domains, and associated analytics via a RESTful API. The process involves account registration, API key generation, and implementation of an authenticated request. Developers can choose between direct HTTP requests to the Clico API reference or utilizing the provided Node.js SDK for integration.
The following table summarizes the key steps:
| Step | What to do | Where |
|---|---|---|
| 1. Sign up | Register for a Clico account. | Clico homepage |
| 2. Get API Key | Generate an API key from your dashboard. | Clico Dashboard > Settings > API Keys |
| 3. Make Request | Send a request to shorten a URL. | Your development environment (cURL, Node.js SDK) |
| 4. Verify | Confirm the short URL is created and accessible. | Clico Dashboard > Links, or by visiting the short URL |
Create an account and get keys
To access the Clico API, an account is required. Clico offers a free tier that includes 500 links and support for one custom domain, suitable for initial development and testing. Paid plans are available for increased usage and features.
Account registration
- Navigate to the Clico website.
- Click on the "Sign Up" or "Get Started Free" button.
- Provide the required registration details, typically including an email address and password.
- Complete any email verification steps if prompted.
API key generation
After successfully registering and logging into your Clico account, you will need to generate an API key. This key serves as a credential to authenticate your requests to the Clico API.
- Log in to your Clico dashboard.
- Locate the "Settings" or "API Keys" section, typically found in the user profile or account management menu.
- Click on "Generate New API Key" or a similar option.
- A unique API key will be displayed. Copy this key immediately, as it may not be retrievable again for security reasons. Treat your API key like a password; do not expose it in client-side code or public repositories.
- For secure handling of API keys, consider environment variables or secret management services, as recommended for general API key security practices.
Your first request
With an API key in hand, you can now make your first request to the Clico API. This example demonstrates shortening a URL. Clico's API is a RESTful service, meaning it uses standard HTTP methods (GET, POST, PUT, DELETE) to interact with resources.
The base URL for the Clico API is https://api.clico.io/v1. All requests should be sent to this endpoint, with specific paths for different actions.
Using cURL (HTTP Request)
This example uses curl to make a POST request to the /links endpoint to create a new short URL. Replace YOUR_API_KEY with the key you generated and https://example.com/long-url with the URL you wish to shorten.
curl -X POST \
https://api.clico.io/v1/links \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{ "long_url": "https://www.apispine.com/documentation/best-practices/api-security-fundamentals" }'
A successful response will return a JSON object containing details of the newly created short link, including the short_url field:
{
"id": "clico_link_id",
"long_url": "https://www.apispine.com/documentation/best-practices/api-security-fundamentals",
"short_url": "https://clico.link/abcde",
"domain": "clico.link",
"created_at": "2026-05-29T12:00:00Z"
}
Using the Node.js SDK
Clico provides a Node.js SDK to simplify integration for JavaScript developers. First, install the SDK:
npm install @clico/sdk
Then, use the SDK to create a short link:
const Clico = require('@clico/sdk');
const clico = new Clico('YOUR_API_KEY');
async function createShortLink() {
try {
const response = await clico.links.create({
long_url: 'https://www.apispine.com/documentation/best-practices/api-security-fundamentals',
});
console.log('Short Link Created:', response.data);
} catch (error) {
console.error('Error creating short link:', error.response ? error.response.data : error.message);
}
}
createShortLink();
The response.data object will contain the same structure as the cURL example, including the short_url.
Common next steps
After successfully making your first API call, consider these next steps to further integrate Clico into your applications:
- Explore Link Analytics: Clico provides detailed analytics for your short links, including click counts, referrer data, and geographical information. The API allows retrieval of these metrics for programmatic use. Refer to the Clico link analytics documentation for details.
- Custom Domains: Configure and use custom domains for your shortened links to reinforce branding. This involves adding your domain in the Clico dashboard and updating DNS records. Consult the Clico documentation on custom domains for setup instructions.
- QR Code Generation: Clico supports generating QR codes for your short links. The API provides endpoints to create and retrieve QR codes, which can be useful for print media or offline marketing.
- Error Handling: Implement robust error handling in your application to manage potential issues such as invalid API keys, malformed requests, or rate limiting. The Clico API returns standard HTTP status codes and detailed error messages in JSON format.
- Webhooks: For real-time notifications about link events (e.g., new clicks), explore Clico's webhook capabilities. Webhooks allow Clico to send automated HTTP POST requests to a specified URL in your application when certain events occur. For general best practices on securing webhooks, refer to Twilio's webhook security guide.
Troubleshooting the first call
Encountering issues during your initial API call is common. Here are some troubleshooting steps:
- Check API Key: Ensure your API key is correct and included in the
Authorization: Bearer YOUR_API_KEYheader. A common mistake is a typo or an expired key. Regenerate the key if necessary from your Clico dashboard settings. - Content-Type Header: Verify that the
Content-Type: application/jsonheader is set for POST requests that include a JSON body. Incorrect content types can lead to API rejection. - Request Body Format: Confirm that your JSON request body is valid and correctly structured according to the Clico API specification for creating links. Missing required fields or incorrect data types will result in an error.
- HTTP Status Codes: Pay attention to the HTTP status code returned in the API response. Common error codes include:
400 Bad Request: Indicates a problem with the request body or parameters.401 Unauthorized: Typically means an invalid or missing API key.403 Forbidden: May indicate insufficient permissions or a rate limit violation.429 Too Many Requests: You have exceeded the API rate limits. Implement a backoff strategy.5xx Server Error: An issue on the Clico server side. If persistent, check the Clico status page or contact support.
- SDK Specific Errors: If using the Node.js SDK, examine the
error.response.datafield for detailed error messages from the API. The SDK wraps HTTP errors in its own error objects. - Documentation Review: Refer to the official Clico documentation for specific endpoint requirements and error codes.