Skip to main content
Welcome to the Dashlink API documentation. This guide will help you integrate Dashlink’s powerful link management features into your application.

Getting Started

To get started with the Dashlink API, you’ll need to understand the base URL structure. All API requests are made to a base URL, and individual endpoints are appended to this base URL.

Base URL

The base URL is the root address for all Dashlink API endpoints. All API requests must be made to this base URL, followed by the specific endpoint path.
Production Base URL
https://dashlink.ai
The base URL serves as the foundation for all API interactions. When making requests, you’ll append the specific endpoint path to this base URL. For example, to access the get shortlinks endpoint, you would use:
API Endpoint
https://dashlink.ai/api/v1/shortlinks/get_shortlinks
All API endpoints in this documentation are relative to the base URL. When you see an endpoint like /api/v1/links, it should be appended to the base URL to form the complete request URL.

Authentication

All API requests to the Dashlink API require authentication using an API key. You can generate your API key from the Dashlink app dashboard. To authenticate your requests, include the X-API-Key header in all API calls with your API key as the value.
API Request Header
X-API-Key: dlk_live_••••••
Here is the example of how your request have send the auth header:
cURL
curl --location 'https://dashlink.ai/api/v1/shortlinks/get_shortlinks' \
--header 'X-API-Key: dlk_live_••••••'
Keep your API key secure and never expose it in client-side code or public repositories. Treat your API key as a password.

Error Handling

The Dashlink API returns errors in a consistent format using standard HTTP status codes. All error responses follow the same structure, making it easy to handle errors in your application. Here is the example of how error response schema looks like:
Error Response
{
    "error": {
        "message": "You must be logged in or provide a valid API key to access this resource.",
        "status_code": 401,
        "code": "AUTHENTICATION_REQUIRED"
    }
}
Common HTTP Status Codes:
Status CodeDescription
200 OKThe request was successful
201 CreatedThe resource was successfully created
400 Bad RequestThe request was invalid or malformed
401 UnauthorizedAuthentication required or invalid API key
403 ForbiddenYou don’t have permission to access this resource
404 Not FoundThe requested resource does not exist
422 Unprocessable EntityThe request was well-formed but contains validation errors
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorAn unexpected error occurred on the server
Always check the status_code and code fields in the error response to handle different error scenarios appropriately in your application.

Pagination & Sorting

All listing APIs in the Dashlink API support pagination and sorting to help you efficiently retrieve and organize data. Pagination Parameters:
  • page - The page number to retrieve (default: 1)
  • per_page - Number of items per page (default: 10)
  • sort_by - Field to sort by (e.g., most_recent, created_at, updated_at)
  • order - Sort order: asc for ascending or desc for descending (default: desc)
Example Request with Pagination:
cURL
curl --location 'https://dashlink.ai/api/v1/shortlinks/get_shortlinks?page=1&per_page=10&sort_by=most_recent&order=desc' \
--header 'X-API-Key: dlk_live_••••••'
The pagination parameters can be combined to customize how you retrieve data. For example, you can sort by creation date in descending order and retrieve 20 items per page.