NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

Short Code Generator API

GET

Produce random alphanumeric codes for vouchers, invites, and links.

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.

Try it — live request, no key required

Request
GETapi.apiverve.com/v1/shortcodegenerator
Verification
Format

No key required to try it. Get a key to use it in your app.

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

About the Short Code Generator API

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.

How it works

Each character of each code is picked independently with Node's crypto.randomInt, a cryptographically secure source, from the set named by charset. The sets are fixed: alphanumeric (the default) uses A-Z, a-z and 0-9, 62 characters; alpha uses A-Z and a-z, 52; numeric uses 0-9; hex uses 0-9 and lowercase a-f; and base58 uses 58 characters that omit 0, O, uppercase I and lowercase l, so codes can be read aloud or typed from print with fewer mistakes. charset is case-insensitive.

length sets characters per code, from 4 to 32 with a default of 8. count sets how many codes are returned, from 1 to 100 with a default of 1.

The number of possible codes is the size of the set raised to the power of the length. An 8-character alphanumeric code has 62^8 possibilities while a 6-digit numeric code has only 10^6, so choose the set and length with the size of your campaign in mind. Codes within a batch are not deduplicated against each other or against earlier requests; collisions are unlikely at reasonable lengths but possible, especially with short numeric codes, so check new codes against the ones you have already issued.

The response echoes length, charset and count, the actual number of entries in codes. url_safe is true for all five sets, because none of them contains a character that needs escaping in a URL path or query string.

What people use it for

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

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use Short Code Generator

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the Short Code Generator API.

Read the docs →
How many code generation requests does the Free plan cover?
The Free plan covers 200 requests per month at 1 credit per call. For higher volumes, the Starter plan covers 200,000 requests monthly, which works out to about $0.15 per 1,000 calls.
Which character sets can I use for generating codes?
You can select from alphanumeric, alphabetic, numeric, hexadecimal, or Base58 character sets. You can also specify the exact character length for the generated codes.
Can I generate codes that exclude visually ambiguous characters?
Yes. Using the Base58 character set automatically excludes easily confused characters such as uppercase I, lowercase l, and the number 0. This makes codes easier for users to read and type manually.
Can I generate a batch of codes in a single request?
Yes. Pass the count parameter to generate multiple codes at once. The API returns an array containing all generated codes along with the requested count, length, and charset.
Are the generated codes safe to use in website URLs?
Yes. The supported character sets produce standard alphanumeric characters that are URL-safe, making them suitable for URL shorteners and redirect paths.

Ready to build with Short Code Generator? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs