/api/shorten
Info
Requires authentication
POST Shorten a URL
Headers
| Header Name | Type | Description |
|---|---|---|
Zws | boolean | If this header is present it will create a zero-width-space url |
Max-Views | number | The maximum amount of views before the url is deleted |
Authorization | string | A required field, your users auth token |
Body (JSON)
| Field Name | Type | Description |
|---|---|---|
url | string | The URL to shorten |
vanity | string? | The vanity URL to use. If the vanity is used already, it will error out. |
{"url": "https://google.com","vanity": "1234"}
200 Ok (JSON)
| Field Name | Type | Description |
|---|---|---|
url | string | The shortened URL |
{"url": "https://example.com/go/1234"}
200 Ok (Text)
If the No-JSON header is present, it will return a text response. This is useful if you want to skip the JSON parsing, which can be slow in the case of jq.
https://example.com/go/1234
400 Bad Request (JSON)
no body- No JSON body was provided.no url- No URL was provided. (.url)invalid max views (invalid number)- TheMax-Viewsheader is set to an invalid number.invalid max views (max views < 0)- TheMax-Viewsheader is set to a number less than 0.vanity already exists- If a vanity is provided, and it exists.vanity is empty- If a vanity is provided, and it is empty (no empty strings).
401 Forbidden (JSON)
no authorization- TheAuthorizationheader is not present.authorization incorrect- TheAuthorizationheader is incorrect.
Last updated: 11/7/2023
Edit this page on GitHub