Skip to main content

Getting started with the API

Create your first Bytes short link via the API in under 5 minutes.

What you need

  • A Bytes account - sign up free
  • A terminal or API client (curl, Postman, Insomnia)

Step 1: Create an API key

  1. Sign in to your Bytes dashboard
  2. Go to Workspace Settings → API
  3. Select Create API key
  4. Give it a name, for example: Getting started test
  5. Select Create API key
  6. Copy the key immediately — it is shown only once

Your key will look like this:

jb_live_xxxxxxxxxxxxxxxxxxxx

Store it somewhere safe before continuing.


Paste this into your terminal, replacing <api_key> with the key you just copied:

curl -X POST https://api.jaww.ws/api/v1/links \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <api_key>" \
-d '{
"destination_url": "https://example.com",
"title": "My first API link"
}'

Step 3: Check the response

A successful response looks like this:

{
"message": "Short link created successfully.",
"link": {
"id": 1,
"slug": "ab3cd",
"destination_url": "https://example.com",
"short_url": "https://jaww.ws/s/ab3cd",
"title": "My first API link",
"is_active": true,
"click_count": 0,
"unique_click_count": 0
}
}

Your short link is live at the short_url in the response. Open it in a browser to confirm it redirects to your destination.


Step 4: Try a custom slug

Add a slug field to give your link a memorable, readable path:

curl -X POST https://api.jaww.ws/api/v1/links \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <api_key>" \
-d '{
"destination_url": "https://example.com/landing",
"slug": "my-campaign",
"title": "Campaign landing page",
"channel": "print"
}'

This creates https://jaww.ws/s/my-campaign.

The channel field tags the link with its marketing channel. Use print for links going on physical materials, this unlocks print-specific analytics in your dashboard.


Sign in to your Bytes dashboard and open Links. Your new links will appear there with live click analytics as soon as they receive their first visit.


Next steps


Troubleshooting

401 Unauthorized

Your API key is missing, incorrect, or has been revoked. Double-check the key and ensure you are sending it as Authorization: Bearer <api_key>.

422 Unprocessable Content — destination URL

The destination must be a valid http or https URL. Check for typos or missing protocol.

422 Unprocessable Content — slug not available

The slug you chose is already in use in your workspace. Try a different slug or omit the field to let Bytes generate one automatically.

Your workspace has reached the active-link limit for its current plan. Deactivate unused links or upgrade your plan.