The Goto Website API
Use the Go2.ws API to create short URLs and generate QR codes from them.
Base URL
https://api.go2.ws
Create a Short URL
Endpoint: POST /generate
This is the public URL creation endpoint used by the Go2.ws site. Send a URL and the API returns a short code and full short URL.
Request
{
"url": "www.example.com"
}
If the URL does not include a scheme, Go2.ws currently treats it as http://.
Response
{
"id": "qEYXpr",
"shortUrl": "https://go2.ws/qEYXpr"
}
cURL
curl -X POST https://api.go2.ws/generate \
-H "Content-Type: application/json" \
-d '{"url": "www.example.com"}'
JavaScript
async function createShortUrl() {
const response = await fetch("https://api.go2.ws/generate", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
url: "www.example.com"
})
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || "Failed to create short URL");
}
return response.json();
}
Python
import requests
response = requests.post(
"https://api.go2.ws/generate",
json={"url": "www.example.com"},
)
response.raise_for_status()
result = response.json()
print(result["shortUrl"])
Generate a Basic QR Code
Endpoint: POST /qr/generate
Generate a PNG QR code for an existing Go2.ws short URL.
Request
{
"shortId": "qEYXpr",
"type": "Basic",
"errorCorrection": "medium",
"moduleSize": 10,
"quietZone": 4,
"backgroundFill": true,
"backgroundColor": "#ffffff",
"moduleColorDark": "#000000",
"moduleColorLight": "#ffffff"
}
Response
The response body is an image/png.
Options
Shared QR options include shortId, type, errorCorrection, moduleSize, and quietZone.
Supported errorCorrection values are low, medium, quartile, and high.
Basic QR options include:
{
"backgroundFill": true,
"backgroundColor": "#ffffff",
"moduleShapeDark": "Square",
"moduleShapeLight": "Square",
"moduleColorDark": "#000000",
"moduleColorLight": "#ffffff",
"finderShape": "Square",
"finderColorDark": "#000000",
"finderColorLight": "#ffffff",
"alignmentShape": "Square",
"alignmentColorDark": "#000000",
"alignmentColorLight": "#ffffff",
"useSafeCenter": false,
"centerImage": "uploaded-image-id"
}
Error Handling
JSON error responses use this shape:
{
"message": "Missing or empty url."
}
Common errors include:
400 Bad Request: The request was invalid.403 Unauthorized: The request needs a valid account session.404 Not Found: The requested short URL, API key, or image could not be found.500 Internal Server Error: The API could not complete the request.