/api/user/urls
Create new shortened URLs or view all of your existing URLs.
This endpoint requires authentication.
GET Request
Get all URLs owned by the authenticated user, or search URLs by field.
Query Parameters
Name | Type | Description |
---|---|---|
searchField | 'destination' | 'vanity' | 'code' | Field to search by. Default: 'destination' . |
searchQuery | string | String to search for (partial match, case-insensitive). |
Response
Status: 200 OK
Content-Type: application/json
An array of Url objects (with the password omitted).
POST Request
Create a new shortened URL.
Body
Content-Type: application/json
Property | Type | Description |
---|---|---|
destination | string | Required. The original URL to shorten. |
vanity | string? | Custom alias for the URL. Must be unique. |
enabled | boolean? | Whether the URL is active/enabled. Defaults to true . |
Headers
These are options that can be set in the request headers:
Header Name | Type | Description |
---|---|---|
x-zipline-max-views | string | (Optional) Maximum allowed views for this URL. |
x-zipline-no-json | string | If present, response will be plain text instead of JSON. See the response below for more info. |
x-zipline-domain | string | (Optional) Use a specific domain for the returned URL. |
x-zipline-password | string | (Optional) Password for this short link. |
Example
Request body, shorten https://github.com with a custom alias, "github"
:
{"destination": "https://github.com/","vanity": "github"}
Headers, set maximum views to 100 and add a password:
x-zipline-max-views: 100x-zipline-password: mysecretpassword
Response
Status: 200 OK
Content-Type: application/json
(or text/plain
if x-zipline-no-json
header is present)
If JSON: A Url object with additional properties:
Property | Type | Description |
---|---|---|
url | string | The accessible URL. |
If plain text: The shortened URL as a plain text string without any formatting:
https://zipline.diced.sh/go/github
Error Responses
-
400 Bad Request
- Destination is missing.
- Vanity is already taken.
- Max views is not a valid number or is less than zero.
-
403 Forbidden
- Creating the URL would exceed your quota.