Bulk Operations

Create up to 1,000 short links in a single request

The Bulk Operations endpoint lets you create large batches of short links efficiently. Instead of making individual POST /api/createShort calls, you can submit up to 1,000 links in a single request. Errors are reported per-link, so partial successes are handled gracefully.

Create Bulk Links

POST /api/bulk

Request body

{
  "links": [
    {
      "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTE=",
      "customSlug": "page-one"
    },
    {
      "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTI=",
      "expiry": "2026-12-31T23:59:59Z"
    },
    {
      "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTM="
    }
  ]
}

Per-link fields

Field Type Required Description
long string Yes Base64-encoded destination URL for this link
customSlug string No Custom alias (Pro plan). Returns an error for this link if the slug is already taken.
expiry ISO 8601 No Expiry date and time for this link

Limits

  • Maximum 1,000 links per request
  • Each link's long field must be Base64-encoded, same as the single-link endpoint
  • Bulk requests count against your plan's daily link creation limit

Response

{
  "created": 2,
  "links": [
    { "shortUrl": "page-one", "url": "https://awsys.co/page-one" },
    { "shortUrl": "xk9p2q", "url": "https://awsys.co/xk9p2q" },
    {
      "error": "SLUG_TAKEN",
      "message": "Custom slug 'page-three' is already in use"
    }
  ]
}

The response array is parallel to the request array — each index corresponds to the link at the same position in your request. Links that fail include an error field rather than shortUrl and url.

Rate limits for bulk

Bulk requests have lower rate limits than the single-link endpoint. See Rate Limits for details per plan.

curl example — 3-link batch

curl -X POST https://awsys.co/api/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "links": [
      { "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTE=" },
      { "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTI=", "customSlug": "page-two" },
      { "long": "aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdlLTM=", "expiry": "2026-12-31T23:59:59Z" }
    ]
  }'

CSV Import Workflow

A common pattern is importing a list of URLs from a CSV file. Here is a shell workflow that reads URLs from a CSV, Base64-encodes them, and calls the bulk endpoint:

#!/usr/bin/env bash
# urls.csv has one URL per line

LINKS=$(python3 - <<'EOF'
import csv, base64, json, sys

links = []
with open('urls.csv') as f:
    for row in csv.reader(f):
        url = row[0].strip()
        if url:
            links.append({"long": base64.b64encode(url.encode()).decode()})

print(json.dumps({"links": links}))
EOF
)

curl -X POST https://awsys.co/api/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$LINKS"

The response array maps 1-to-1 with your input rows, so you can zip the input URLs with the response links array to build a complete input→output mapping.