Create Link

POST https://api.example.com/api/link
Requires authentication: x-api-key: YOUR_API_KEY

Creates a new shortened link. The link name and destination URL must be supplied in the request body. The link is attributed to API as its creator.

Headers

  • x-api-key string required
    Your API authentication key.
    Example: YOUR_API_KEY

Body parameters

  • name string required
    The unique name to assign to the shortened link.
    Example: google
  • url string required
    The destination URL for the shortened link.
    Example: https://google.com

Responses

  • 201Created
  • 409Conflict
Request
curl -X POST 'https://api.example.com/api/link' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "google",
  "url": "https://google.com"
}'
Response
Created
{
  "id": 1,
  "name": "google",
  "url": "https://google.com",
  "count": 0,
  "creator": "API",
  "creatorID": "0",
  "createdAt": 1795400000000
}