DPLink

API Documentation

Integrate DPLink into your applications. Shorten URLs and generate QR codes programmatically with our simple REST API.

Base URL

https://dplnk.in

Authentication

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

  1. Sign in to your DPLink account
  2. Navigate to Dashboard → API Keys
  3. Click "Create API Key" and give it a descriptive name
  4. 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.

PlanRate LimitWindow
Default100 requestsPer hour

When rate limited, the API returns a 429 status code. Wait until the current window resets before retrying.

Endpoints

POST/api/v1/shorten

Create a shortened URL. Optionally specify a custom code, domain, or title.

Request Body

ParameterTypeRequiredDescription
urlstringYesThe URL to shorten
customCodestringNoCustom short code (e.g., "my-link")
domainstringNoCustom domain to use
titlestringNoDescriptive 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/qr

Generate a QR code in PNG (base64) and SVG formats.

Request Body

ParameterTypeRequiredDescription
contentstringYesData to encode (URL, text, etc.)
sizenumberNoImage size in pixels (50-2000, default: 300)
foregroundstringNoForeground hex color (default: "#000000")
backgroundstringNoBackground hex color (default: "#FFFFFF")
errorLevelstringNoError 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 string

Response 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.

StatusCodeDescription
400Bad RequestInvalid parameters, missing required fields, or URL failed safety check
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key is inactive or account is disabled
429Too Many RequestsRate limit exceeded. Wait for the current window to reset.
500Internal Server ErrorSomething 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]