Workflows
Replace $BASE_URL with the API origin and $TOKEN with a Bearer token. Scopes are described in authentication. Field rules are on links.
Create a link
The token needs write. Omit alias to get a 6-letter code. A 201 body includes short_url.
curl -sS -X POST "$BASE_URL/api/v1/easyshare/links" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"destination_url":"https://example.com/summer","alias":"summer-sale"}'Reuse a destination
if_exists return responds 200 and sets reused when an active, unarchived link already uses that destination. Send Idempotency-Key when a retry must not create a second link.
curl -sS -X POST "$BASE_URL/api/v1/easyshare/links" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: summer-sale-1" \
-d '{"destination_url":"https://example.com/summer","if_exists":"return"}'Change a destination
Patch the alias, then read history with a token that has read.
curl -sS -X PATCH "$BASE_URL/api/v1/easyshare/links/summer-sale" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"destination_url":"https://example.com/fall"}'
curl -sS "$BASE_URL/api/v1/easyshare/links/summer-sale/history" \
-H "Authorization: Bearer $TOKEN"Disable, archive, or delete
Disable stops the redirect. Archive hides the link from the default list and leaves the redirect in place. Delete reserves the alias and the public URL returns 410.
curl -sS -X PATCH "$BASE_URL/api/v1/easyshare/links/summer-sale" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"disabled"}'
curl -sS -X PATCH "$BASE_URL/api/v1/easyshare/links/summer-sale" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"archived":true}'
curl -sS -X DELETE "$BASE_URL/api/v1/easyshare/links/summer-sale" \
-H "Authorization: Bearer $TOKEN"Read click stats
The token needs analytics. Add format=csv for key,clicks. Workspace stats use /api/v1/easyshare/stats and can filter with tag.
curl -sS "$BASE_URL/api/v1/easyshare/links/summer-sale/stats?group_by=day" \ -H "Authorization: Bearer $TOKEN" curl -sS "$BASE_URL/api/v1/easyshare/links/summer-sale/stats?group_by=day&format=csv" \ -H "Authorization: Bearer $TOKEN"
Create many links
Bulk create returns 200 and one result per row. A row error does not undo the rows that succeeded.
curl -sS -X POST "$BASE_URL/api/v1/easyshare/links/bulk" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"items":[{"destination_url":"https://example.com/a"},{"destination_url":"https://example.com/b","alias":"launch"}]}'