# Short Code Generator API

> Short Code Generator creates custom alphanumeric short codes for vouchers, referral tokens, and redirect slugs. Specify a length, batch count, and character set like numeric, hex, or Base58 to receive an array of random strings.

**Endpoint:** `GET https://api.apiverve.com/v1/shortcodegenerator`  
**Category:** Data Generation  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/shortcodegenerator

## Overview

Short Code Generator creates random short codes for voucher codes, promo code and coupon code campaigns, referral tokens, invite links and redirect slugs. Set how long each code should be, how many you need in one batch and which character set to draw from: mixed-case alphanumeric, letters only, digits only, lowercase hex, or Base58, which leaves out characters that are easy to misread.

Marketing teams use it to issue promo codes, apps use it to mint invite and referral codes, and URL shortener services use it for slugs. Codes are drawn from a cryptographic random source, so they are hard to guess even when they are short.

Every field is available on the Free plan. Each response returns the codes as an array along with the length, character set and count used, and a flag confirming the codes are URL safe, so they can go straight into a link without encoding. Store issued codes on your side and check new ones against them if a campaign needs strict uniqueness.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/shortcodegenerator?count=5&length=8&charset=alphanumeric" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | integer | No | Number of codes to generate. Codes are unique within one response; uniqueness across calls is up to you. default 1. range 1-100 |
| `length` | integer | No | Length of each code. default 8. range 4-32 |
| `charset` | string | No | Character set. uppercase is A-Z and 0-9; unambiguous is uppercase without 0, O, 1, I or L, for printed vouchers people retype. default alphanumeric. One of: alphanumeric, alpha, numeric, hex, base58, uppercase, unambiguous |

## Response fields

- `codes` — array · Array of generated short codes, with no duplicates within the response
- `count` — number · Number of codes generated
- `length` — number · Length of each generated code
- `charset` — string · Character set used for generation
- `url_safe` — boolean · Whether the generated codes are safe to use in a URL without encoding

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "codes": [
      "bgiFznFh",
      "jr84hHsG",
      "Q77qABwn",
      "gvMjXxXs",
      "WDPJzCsi"
    ],
    "count": 5,
    "length": 8,
    "charset": "alphanumeric",
    "url_safe": true
  }
}
```

## Use cases

- **URL Shortening** — Generate short codes for URL shortening services and link tracking
- **Voucher Systems** — Create unique voucher and coupon codes for e-commerce and promotions
- **Temporary Access** — Generate temporary access codes and one-time passwords for authentication
- **Referral Programs** — Create short referral codes for marketing and referral tracking systems

## SDKs

- **npm** — `npm install @apiverve/shortcodegenerator` (https://www.npmjs.com/package/@apiverve/shortcodegenerator)
- **NuGet** — `dotnet add package APIVerve.API.ShortCodeGenerator` (https://www.nuget.org/packages/APIVerve.API.ShortCodeGenerator)
- **Source** — https://github.com/apiverve/shortcodegenerator-api

## More

- Full reference: https://docs.apiverve.com/ref/shortcodegenerator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
