Rebrandly for Developers

Use our API to create, track and share custom short links that incorporate your brand domain name.

Get Started

Updating a script

Scripts can be updated via a POST method to https://api.rebrandly.com/v1/scripts/:id, where :id is the unique identifier (id) of the script, which accepts a JSON object describing the Script.

Check compatibility first

Double check whether your API key or OAuth token is enabled to use the Scripts feature.
For every account, you can check for features and limits with a preliminary API call.

PATH Parameters

Path parameter
Description

id

Unique identifier of the script you want to update

Script Parameters

The table below shows the parameters you should specify when updating a script.
If you do not want to modify some parameters, you can simply leave them unchanged, i.e. pass their values as you originally received them.

Tag property
Type
Constraints
Description

name

string

required
UTF8
Min 3 chars
Max 255 chars

New name you want to assign to the script

value

string

required
Valid javascript code

Javascript snippet including opening and closing <script> HTML tags

Updating an existing script

$ curl 'https://api.rebrandly.com/v1/scripts/gewa4cc5b6ee45d6gkj65b06ac2d1hww' \
-X POST \
-H 'apikey: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d \
'{
  "name": "NewAlert",
  "value": "<script>alert('test');</script>"
}'

HTTP/1.1 200 OK

JSON response (updated script)

{
  "id": "gewa4cc5b6ee45d6gkj65b06ac2d1hww",
  "name": "NewAlert",
  "color": "<script>alert('test');</script>"
}

Handling errors

HTTP status
Error type
Description

403

Invalid Link object. Double check value for property field. Details about validation failure in message field

404

404 - Not found
with property value "id"

Given id does not correspond to any existing script

Updating a script


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.