Documentation
Set defaults for new links
PUT
/v1/link_defaultsLinksReplaces the whole set: a field left out or null goes back to what every link starts with. Links already made keep their settings. A domain must be one of the account's own.
Request body
JSON, sent with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
domain | string, null | optional | |
redirect | 301 | 302 | null | optional | |
expires_in_days | integer, null | optional | |
forward_query | boolean, null | optional | |
track | boolean, null | optional | |
snapshots | public | private | off | null | optional |
Example request
Terminal
curl "https://snip.link/v1/link_defaults" \
-X PUT \
-H "Authorization: Bearer $SNIP_KEY" \
-H "Content-Type: application/json" \
-d '{}'Example response
Response
{
"defaults": {
"domain": "go.example.com",
"domain_ready": true,
"redirect": 302,
"expires_in_days": null,
"forward_query": true,
"track": true,
"snapshots": "public"
}
}Response fields
| Field | Type | Description |
|---|---|---|
defaults | LinkDefaults | |
defaults.domain | string, null | The account's own domain new links go on; null for snip.link. |
defaults.domain_ready | boolean, null | False while that domain cannot take new links (not live, removed, or the plan has none): new links go on snip.link meanwhile. Null when no domain is set. |
defaults.redirect | 301 | 302 | |
defaults.expires_in_days | integer, null | New links expire this many days after they are made; null for never. |
defaults.forward_query | boolean | Pass the short link's query string on to the destination. |
defaults.track | boolean | False: new links only count visits, without recording each one. |
defaults.snapshots | public | private | off | Whether new links save a copy of their page, and who may open it. |
Errors
| Status | Meaning |
|---|---|
| 400 | The body or query is invalid. details names each field. |
| 401 | The API key is missing, malformed or revoked. |
| 403 | The plan does not include this. details.upgrade names the plan that does. |
| 429 | Either the key exceeded its requests-per-second limit (honor Retry-After), or a daily or plan quota is used up (details.reason). |