Introduction
URL Shortener API - Create, manage and redirect short URLs
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
This API is not authenticated.
Endpoints
GET api/urls
Example request:
curl --request GET \
--get "http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"search\": \"example.com\",
\"per_page\": 15,
\"page\": 1
}"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "example.com",
"per_page": 15,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (400):
Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
{
"error": "Device ID required"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
POST api/urls
Example request:
curl --request POST \
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"url\": \"https:\\/\\/www.example.com\\/very\\/long\\/path\\/to\\/resource\"
}"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"url": "https:\/\/www.example.com\/very\/long\/path\/to\/resource"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/urls/{id}
Example request:
curl --request GET \
--get "http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/architecto" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/architecto"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (404):
Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
{
"message": ""
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
PUT api/urls/{id}
Example request:
curl --request PUT \
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/1" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"url\": \"https:\\/\\/www.updated-example.com\\/new\\/path\"
}"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/1"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"url": "https:\/\/www.updated-example.com\/new\/path"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
DELETE api/urls/{id}
Example request:
curl --request DELETE \
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/1" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/urls/1"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/resolve/{code}
Example request:
curl --request GET \
--get "http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/resolve/NG4" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://shrt-production-alb-132772302.us-east-1.elb.amazonaws.com/api/resolve/NG4"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (404):
Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
access-control-allow-origin: *
{
"message": "No se encontró la URL solicitada."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.