Introduction


Suff is a URL shortening service that converts long URLs into compact, shareable links.

The Suff API allows you to programmatically:

  • Create short links
  • Retrieve a paginated list of your short links
  • Delete short links

Base URL

https://suff.me/api/v1/

Request & Response Format

All requests and responses use Content-Type: application/json.

API Versioning

The current version is v1, indicated in the URL path (/api/v1/). Future versions will be released under /api/v2/ etc.

Authentication


The API uses Bearer token authentication via the HTTP Authorization header. Your token is called the Secret and is tied to your Suff user account.

How to get a Secret

  1. Log in to your Suff account.
  2. Go to API Secret in the sidebar (or navigate to /credential).
  3. Click Generate Secret.
  4. Copy the displayed token ÔÇö treat it like a password; do not share it.
  5. To revoke access, click Delete Secret. To rotate the token, click Regenerate Secret.

Using the Secret

Include the token in every API request via the Authorization header:

Authorization: Bearer <your-secret>

Example

curl -H "Authorization: Bearer H5iVunjypxoyL8bcbRfBNrRyYj8QfPxW" \n     https://suff.me/api/v1/short-links

Error when token is missing or invalid

{ "status": 401, "message": "Your request was made with invalid credentials." }

Create a Short Link


Shorten a URL by posting it to the API. If the same URL was already shortened by the same user, the existing record is returned ÔÇö no duplicate is created.

MethodPOST
Endpoint/api/v1/short-links
AuthBearer token required

Request Headers

Authorization: Bearer <your-secret>
Content-Type: application/json

Request Body

{
  "url": "https://example.com/very/long/path?with=query"
}
FieldTypeRequiredRules
urlstringYesMust be a valid URL (max 2048 chars)

Success ÔÇö 201 Created

{
  "id": 42,
  "url": "https://example.com/very/long/path?with=query",
  "uri": "dOYacYg",
  "short_url": "https://suff.me/dOYacYg",
  "created_at": 1709380000
}

short_url is the ready-to-use shortened link.

Validation Error ÔÇö 400 Bad Request

{
  "status": 400,
  "message": "Validation failed.",
  "errors": {
    "url": ["URL is not valid."]
  }
}

Get Short Links


Retrieve a paginated list of short links belonging to the authenticated user. Results are ordered newest first.

MethodGET
Endpoint/api/v1/short-links
AuthBearer token required

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-based)
per_pageinteger20Results per page (max 100)

Success ÔÇö 200 OK

{
  "items": [
    {
      "id": 42,
      "url": "https://example.com/very/long/path?with=query",
      "uri": "dOYacYg",
      "short_url": "https://suff.me/dOYacYg",
      "created_at": 1709380000
    }
  ],
  "pagination": {
    "total": 85,
    "page": 1,
    "per_page": 20,
    "total_pages": 5
  }
}

created_at is a Unix timestamp (seconds since epoch).

Delete a Short Link


Permanently delete a short link by its ID. Only the owner of the link may delete it.

MethodDELETE
Endpoint/api/v1/short-links/{id}
AuthBearer token required

Path Parameter

ParameterTypeDescription
idintegerThe id of the short link to delete (from the list endpoint)

Success ÔÇö 204 No Content

Empty response body on success.

Error Responses

StatusReason
401 UnauthorizedMissing or invalid Bearer token
403 ForbiddenThe short link belongs to a different user
404 Not FoundNo short link found with that ID