refer.is

Link Shortening and Click Tracking API

You can interact with refer.is programmatically through its API. The API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

OpenAPI

API documentation is available in the OpenAPI specification format. You can find the OpenAPI specification file here.

Authentication

An API key is required for all requests. Every workspace has its own API key. You can find your API key in the settings page of your workspace under the "API key" section.

To authenticate your requests include the following header:

Authorization: Bearer <API_KEY>

Get Me

Get information about your workspace.

Request

curl -X GET 'https://api.refer.is/v1/me' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>"

Response

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "name": "Workspace name"
  }
}

List Domains

List domains usable in your workspace (your own plus shared system domains).

Request

curl -X GET 'https://api.refer.is/v1/domains' \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).

Response

{
  "data": [
    {
      "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
      "name": "refer.is",
      "status": "connected"
    }
  ],
  "meta": {
    "limit": 10,
    "total": 1,
    "page": 1
  }
}

Get Domain

Get a domain in your workspace, including its verification status.

Request

curl -X GET 'https://api.refer.is/v1/domains/92fc175e-2508-458d-b490-5c78675c8e6b' \
  -H "Authorization: Bearer <API_KEY>"

Response

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "name": "refer.is",
    "status": "connected"
  }
}

Create Domain

Connect a custom domain to your workspace. Verify it afterwards in the workspace settings.

Request

curl -X POST 'https://api.refer.is/v1/domains' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "name": "go.example.com",
    "url": "https://example.com"
  }'

Parameters

ParameterRequiredDescription
nameYesDomain hostname, e.g. go.example.com
urlYesFallback redirect URL for direct domain visits

Response

Returns 201 Created.

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "name": "go.example.com",
    "status": "disconnected"
  }
}

Delete Domain

Remove a custom domain from your workspace. Shared system domains cannot be removed.

Request

curl -X DELETE 'https://api.refer.is/v1/domains/92fc175e-2508-458d-b490-5c78675c8e6b' \
  -H "Authorization: Bearer <API_KEY>"

Response

Returns 204 No Content with an empty body.

Create Link

Create new link in your workspace. List usable domain IDs via List Domains first.

Request

curl -X POST 'https://api.refer.is/v1/links' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "url":"https://google.com",
    "domain_id": "<DOMAIN_ID>"
  }'

Parameters

ParameterRequiredDescription
urlYesDestination URL the short link redirects to
domain_idYesDomain ID from List Domains
slugNoCustom back-half of the link. A random 8-character slug is generated when omitted

Response

Returns 201 Created.

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "slug": "abc",
    "link": "https://refer.is/abc",
    "url": "https://google.com",
    "domain_id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

List Links

List links in your workspace.

Request

curl -X GET 'https://api.refer.is/v1/links?query=google&page=1' \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
queryNoSearch slugs and destination URLs
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).

Response

{
  "data": [
    {
      "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
      "slug": "abc",
      "link": "https://refer.is/abc",
      "url": "https://google.com",
      "domain_id": "92fc175e-2508-458d-b490-5c78675c8e6b",
      "created_at": "2024-01-01T00:00:00.000Z"
    }
  ],
  "meta": {
    "limit": 10,
    "total": 1,
    "page": 1
  }
}

Get Link

Get existing link from your workspace.

Request

curl -X GET 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b' \
  -H "Authorization: Bearer <API_KEY>"

Response

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "slug": "abc",
    "link": "https://refer.is/abc",
    "url": "https://google.com",
    "domain_id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

Update Link

Update the destination URL of an existing link. The id, slug, and stats stay intact.

Request

curl -X PATCH 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "url":"https://example.com"
  }'

Parameters

ParameterRequiredDescription
urlYesNew destination URL the short link redirects to

Response

{
  "data": {
    "id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "slug": "abc",
    "link": "https://refer.is/abc",
    "url": "https://example.com",
    "domain_id": "92fc175e-2508-458d-b490-5c78675c8e6b",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

Delete Link

Delete existing link from your workspace.

Request

curl -X DELETE 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b' \
  -H "Authorization: Bearer <API_KEY>"

Response

Returns 204 No Content with an empty body.

Get QR Code

Get QR code for a link. Public — no API key required, the code encodes the public short URL.

Request

curl -X GET 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b/qr?background_color=%23ffffff&dot_color=%23000000'

Parameters

ParameterRequiredDescription
background_colorNoBackground color as a 6-digit hex, e.g. #ffffff (URL-encoded as %23ffffff)
dot_colorNoDot color as a 6-digit hex, e.g. #000000

Response

Returns an SVG image (image/svg+xml).

Get Browsers Analytics

Get click analytics for browsers.

Request

curl -X GET 'https://api.refer.is/v1/analytics/browsers?start=2024-01-01T00:00:00Z&end=2024-01-31T00:00:00Z' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
startYesISO 8601
endYesISO 8601
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).
link_idNoScope to a single link ID
domain_idNoScope to a single domain ID

Response

{
  "data": [
    {
      "value": "chrome",
      "count": 100
    },
    {
      "value": "safari",
      "count": 50
    }
  ],
  "meta": {
    "limit": 10,
    "total": 2,
    "page": 1
  }
}

Get Countries Analytics

Get click analytics for countries.

Request

curl -X GET 'https://api.refer.is/v1/analytics/countries?start=2024-01-01T00:00:00Z&end=2024-01-31T00:00:00Z' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
startYesISO 8601
endYesISO 8601
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).
link_idNoScope to a single link ID
domain_idNoScope to a single domain ID

Response

{
  "data": [
    {
      "value": "US",
      "count": 100
    },
    {
      "value": "CA",
      "count": 50
    }
  ],
  "meta": {
    "limit": 10,
    "total": 2,
    "page": 1
  }
}

Get Referrers Analytics

Get click analytics for referrers.

Request

curl -X GET 'https://api.refer.is/v1/analytics/referrers?start=2024-01-01T00:00:00Z&end=2024-01-31T00:00:00Z' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
startYesISO 8601
endYesISO 8601
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).
link_idNoScope to a single link ID
domain_idNoScope to a single domain ID

Response

{
  "data": [
    {
      "value": "https://m.facebook.com",
      "count": 50
    },
    {
      "value": "https://x.com",
      "count": 50
    },
    {
      "value": null,
      "count": 50
    }
  ],
  "meta": {
    "limit": 10,
    "total": 3,
    "page": 1
  }
}

Get URLs Analytics

Get click analytics for urls.

Request

curl -X GET 'https://api.refer.is/v1/analytics/urls?start=2024-01-01T00:00:00Z&end=2024-01-31T00:00:00Z' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>"

Parameters

ParameterRequiredDescription
startYesISO 8601
endYesISO 8601
pageNoPage number (default 1).
limitNoItems per page, up to 100 (default 10).
link_idNoScope to a single link ID
domain_idNoScope to a single domain ID

Response

{
  "data": [
    {
      "value": "https://refer.is",
      "count": 20
    },
    {
      "value": "https://refer.is/docs",
      "count": 10
    },
    {
      "value": "https://refer.is/pricing",
      "count": 5
    }
  ],
  "meta": {
    "limit": 10,
    "total": 3,
    "page": 1
  }
}
refer.is/launch3.2Krefer.is/deal1.3Krefer.is/podcast412refer.is/summer-sale8.7Krefer.is/docs956refer.is/webinar2.4Krefer.is/careers640
refer.is/newsletter5.1Krefer.is/event1.9Krefer.is/promo12Krefer.is/app3.6Krefer.is/menu780refer.is/demo1.1Krefer.is/beta2.8K

Start creating branded links today

1,000 tracked clicks and unlimited redirects every month, free.

Get Started - it's free

No credit card required