EN
Shorten link

Company URL API

Create and manage your company’s short links and retrieve their visit statistics.

Authentication

Send your company’s API key in the API_KEY header with each request. You can use Api-Key if your proxy drops headers containing underscores. Keep the key on your server and send it over HTTPS.

You can read or change only links owned by the company identified by the key. A link is eligible when isActive is true and availableTo is either null or later than the current time. A future availableFrom delays the redirect for visitors. The link can still be managed through the API.

Endpoints

Replace {uuid} with the UUID returned when you create a link. Send JSON bodies with Content-Type: application/json.

Method Path Success Behavior
GET /api/url_entry 200 List eligible links. Returns a JSON array.
POST /api/url_entry 201 Create a link. The Location header points to the new entry.
GET /api/url_entry/{uuid} 200 Get one link by UUID.
PUT /api/url_entry/{uuid}/features 200 Replace all features. Omitted fields reset to their defaults.
PATCH /api/url_entry/{uuid}/features 200 Update only the supplied features.
PUT, PATCH /api/url_entry/{uuid}/url 200 Change the destination. Send only the url field.
DELETE /api/url_entry/{uuid} 204 Deactivate the link by setting isActive to false. Returns an empty body.
GET /api/url_entry/{uuid}/statictics 200 Get visit statistics. The /statistics spelling is also supported.

Request fields

Create a link

  • url Required. Use an absolute HTTP or HTTPS URL up to 2,048 characters. The same validation applies when you change the destination.
  • uri Optional. Supply an unused short code of 1 to 255 letters or digits, or omit the field to generate one.
  • The server assigns uuid and createdAt automatically and ignores supplied values. It assigns the company from the key and creates the link as active.

Link features

You can set these fields when creating a link and update them through /features.

  • availableFrom RFC 3339 timestamp, for example 2030-06-01T09:00:00Z. A null or default value uses the link’s creation time.
  • availableTo RFC 3339 timestamp on or after availableFrom. A null or default value means the link has no expiration.
  • password Nonblank string up to 255 characters. Use null to remove the password. The default is null. Responses include hasPassword.
  • isSingleUse Boolean. Defaults to false.

Examples

Set COMPANY_API_KEY in your shell to the key issued for your company.

Create a link

curl --request POST 'https://tteokbokki.me/api/url_entry' \
  --header "API_KEY: ${COMPANY_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{"url":"https://example.com/products"}'

Example response (201)

{
  "id": 42,
  "uuid": "a4ce1501-c6e2-44e6-a972-96fa909efaa6",
  "url": "https://example.com/products",
  "uri": "abcd1234",
  "createdAt": "2030-01-01T12:00:00+00:00",
  "availableFrom": "2030-01-01T12:00:00+00:00",
  "availableTo": null,
  "hasPassword": false,
  "isSingleUse": false,
  "isActive": true
}

Change the destination

curl --request PATCH 'https://tteokbokki.me/api/url_entry/a4ce1501-c6e2-44e6-a972-96fa909efaa6/url' \
  --header "API_KEY: ${COMPANY_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{"url":"https://example.com/new-products"}'

Read statistics

curl 'https://tteokbokki.me/api/url_entry/a4ce1501-c6e2-44e6-a972-96fa909efaa6/statistics' \
  --header "API_KEY: ${COMPANY_API_KEY}"

The response contains urlEntry, totalVisits, uniqueVisitors, and visitsByCountry. The last field maps country codes to visit counts. Visits without a visitor ID contribute to totalVisits. Country counts include visits with a recorded country.

Errors

Validation and access errors return a JSON object with an error message in the error field.

400
The body must be a valid JSON object.
401
The company key is missing, invalid, or expired.
404
The link is missing, inactive, expired, or belongs to another company.
409
The requested short code is already in use.
422
A request field is invalid or unsupported.