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.
API documentation is available in the OpenAPI specification format. You can find the OpenAPI specification file here. You can also use the OpenAPI specification file to generate client libraries for different programming languages.
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 information about your workspace.
curl -X GET 'https://api.refer.is/v1/me' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>"{
"data": {
"id": "92fc175e-2508-458d-b490-5c78675c8e6b",
"name": "Workspace name"
}
}Create new link in your workspace.
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": "refer.is"
}'| Parameter | Required | Description |
|---|---|---|
url | Yes | Destination URL the short link redirects to |
domain | Yes | refer.is or one of your connected custom domains |
slug | No | Custom back-half of the link. A random 8-character slug is generated when omitted |
Returns 201 Created.
{
"data": {
"id": "92fc175e-2508-458d-b490-5c78675c8e6b",
"slug": "abc",
"link": "https://refer.is/abc",
"url": "https://google.com",
"created_at": "2024-01-01T00:00:00.000Z"
}
}Get existing link from your workspace.
curl -X GET 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b' \
-H "Authorization: Bearer <API_KEY>"{
"data": {
"id": "92fc175e-2508-458d-b490-5c78675c8e6b",
"slug": "abc",
"link": "https://refer.is/abc",
"url": "https://google.com",
"created_at": "2024-01-01T00:00:00.000Z"
}
}Delete existing link from your workspace.
curl -X DELETE 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b' \
-H "Authorization: Bearer <API_KEY>"Returns 204 No Content with an empty body.
Get QR code for existing link from your workspace.
curl -X GET 'https://api.refer.is/v1/links/92fc175e-2508-458d-b490-5c78675c8e6b/qr?background_color=%23ffffff&dot_color=%23000000' \
-H "Authorization: Bearer <API_KEY>"| Parameter | Required | Description |
|---|---|---|
background_color | No | Background color as a 6-digit hex, e.g. #ffffff (URL-encoded as %23ffffff) |
dot_color | No | Dot color as a 6-digit hex, e.g. #000000 |
Returns an SVG image (image/svg+xml).
Get click analytics for browsers.
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>"| Parameter | Required | Description |
|---|---|---|
start | Yes | ISO 8601 |
end | Yes | ISO 8601 |
page | No | Page number - each page has up to 100 items. |
{
"data": [
{
"value": "chrome",
"count": 100
},
{
"value": "safari",
"count": 50
}
],
"meta": {
"limit": 100,
"total": 2,
"page": 1
}
}Get click analytics for countries.
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>"| Parameter | Required | Description |
|---|---|---|
start | Yes | ISO 8601 |
end | Yes | ISO 8601 |
page | No | Page number - each page has up to 100 items. |
{
"data": [
{
"value": "US",
"count": 100
},
{
"value": "CA",
"count": 50
}
],
"meta": {
"limit": 100,
"total": 2,
"page": 1
}
}Get click analytics for referrers.
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>"| Parameter | Required | Description |
|---|---|---|
start | Yes | ISO 8601 |
end | Yes | ISO 8601 |
page | No | Page number - each page has up to 100 items. |
{
"data": [
{
"value": "https://m.facebook.com",
"count": 50
},
{
"value": "https://x.com",
"count": 50
},
{
"value": null,
"count": 50
}
],
"meta": {
"limit": 100,
"total": 3,
"page": 1
}
}Get click analytics for urls.
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>"| Parameter | Required | Description |
|---|---|---|
start | Yes | ISO 8601 |
end | Yes | ISO 8601 |
page | No | Page number - each page has up to 100 items. |
{
"data": [
{
"value": "https://refer.is",
"count": 20
},
{
"value": "https://refer.is/docs",
"count": 10
},
{
"value": "https://refer.is/pricing",
"count": 5
}
],
"meta": {
"limit": 100,
"total": 3,
"page": 1
}
}1,000 tracked clicks and unlimited redirects every month, free.
No credit card required
We use cookies (and other similar technologies) to improve your experience on our site.