DPLink
API Documentation
Integrate DPLink into your applications. Shorten URLs and generate QR codes programmatically with our simple REST API.
Base URL
https://dplnk.inAuthentication
All API requests require authentication via an API key. Include your key in the X-API-Key header with every request.
Getting an API Key
- Sign in to your DPLink account
- Navigate to Dashboard → API Keys
- Click "Create API Key" and give it a descriptive name
- Copy your key immediately — it won't be shown in full again
Example Header
X-API-Key: dpk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
Rate Limits
API requests are rate-limited on a per-key basis to ensure fair usage and platform stability.
| Plan | Rate Limit | Window |
|---|---|---|
| Default | 100 requests | Per hour |
When rate limited, the API returns a 429 status code. Wait until the current window resets before retrying.
Endpoints
POST
/api/v1/shortenCreate a shortened URL. Optionally specify a custom code, domain, or title.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | The URL to shorten |
| customCode | string | No | Custom short code (e.g., "my-link") |
| domain | string | No | Custom domain to use |
| title | string | No | Descriptive title for the link |
Example Request (curl)
curl -X POST https://your-domain.com/api/v1/shorten \
-H "Content-Type: application/json" \
-H "X-API-Key: dpk_your_api_key_here" \
-d '{
"url": "https://example.com/very/long/url/that/needs/shortening",
"title": "Example Link"
}'Example Request (JavaScript)
const response = await fetch("https://your-domain.com/api/v1/shorten", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "dpk_your_api_key_here",
},
body: JSON.stringify({
url: "https://example.com/very/long/url/that/needs/shortening",
title: "Example Link",
}),
});
const data = await response.json();
console.log(data.shortUrl);Response 201 Created
{
"id": "clx1abc2def3ghi4jkl",
"code": "aB3xY7z",
"shortUrl": "https://your-domain.com/r/aB3xY7z",
"originalUrl": "https://example.com/very/long/url/that/needs/shortening"
}POST
/api/v1/qrGenerate a QR code in PNG (base64) and SVG formats.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | Data to encode (URL, text, etc.) |
| size | number | No | Image size in pixels (50-2000, default: 300) |
| foreground | string | No | Foreground hex color (default: "#000000") |
| background | string | No | Background hex color (default: "#FFFFFF") |
| errorLevel | string | No | Error correction: L, M, Q, or H (default: "M") |
Example Request (curl)
curl -X POST https://your-domain.com/api/v1/qr \
-H "Content-Type: application/json" \
-H "X-API-Key: dpk_your_api_key_here" \
-d '{
"content": "https://example.com",
"size": 500,
"foreground": "#16a34a",
"errorLevel": "H"
}'Example Request (JavaScript)
const response = await fetch("https://your-domain.com/api/v1/qr", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "dpk_your_api_key_here",
},
body: JSON.stringify({
content: "https://example.com",
size: 500,
foreground: "#16a34a",
errorLevel: "H",
}),
});
const data = await response.json();
// data.png - Base64 PNG data URL
// data.svg - SVG markup stringResponse 200 OK
{
"png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 500 500\">...</svg>"
}Error Codes
The API uses standard HTTP status codes. All error responses include an error field with a human-readable message.
| Status | Code | Description |
|---|---|---|
| 400 | Bad Request | Invalid parameters, missing required fields, or URL failed safety check |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | API key is inactive or account is disabled |
| 429 | Too Many Requests | Rate limit exceeded. Wait for the current window to reset. |
| 500 | Internal Server Error | Something went wrong on our end. Try again later. |
Error Response Format
{
"error": "A human-readable error message describing what went wrong"
}Need help? Contact us at [email protected]