API URL
https://codito.io/free-random-code-generator/api/generate
Request method
POST
Request content type
application/json
Request data
Request data should be a JSON encoded object containing following fields:
Required fields:
-
codesToGenerate - (int)
- number of codes to generate
-
onlyUniques - (bool)
- set to true if you do not want duplicated codes in the generated codes
-
charactersSets - (array of strings)
- list of the allowed characters on each code character position. For example, if you'd like to
generate 10-digit code you need to fill this field with array of 10 strings containing
\d pattern.
Please note that the \
character should be escaped in the JSON string, so you must use the double backslash
\\d notation to
apply the patterns.
Optional fields:
- prefix - (string) - the text added before each code.
- suffix - (string) - the text added after each code.
Example:
{ "codesToGenerate": 5, "prefix": "EXAMPLE-", "onlyUniques": true, "charactersSets": [ "ABC", "123", "\\d" ] }
Codes limit
Maximum 250,000 codes per request.
Rate limit
Maximum 10 successful requests per hour.
Rate limit details
After sending a valid JSON request you can check the current limit, remaining requests and next allowed request
date by checking the response headers.
- x-ratelimit-limit - the requests limit in current time frame.
- x-ratelimit-remainingrequests - the number of remaining requests in current time frame.
- x-ratelimit-nextallowedrequest - the date and time when you can make next generation request.
Example:
x-ratelimit-limit: 10
x-ratelimit-remainingrequests: 0
x-ratelimit-nextallowedrequest: 2024-12-07T02:04:51+00:00
Examples
A simple example of generating 10 six-digit numbers.
Request
curl --header "Content-Type: application/json" \
--request POST \
--data '{ "codesToGenerate": 10, "onlyUniques": true, "charactersSets": [ "\\d", "\\d", "\\d", "\\d", "\\d", "\\d" ] }' \
https://codito.io/free-random-code-generator/api/generate
Response
["398785","077629","920758","773844","195664","986727","224308","501655","151524","573400"]
Generating 5 codes with US-
country prefix and -2024
suffix.
Request
curl --header "Content-Type: application/json" \
--request POST \
--data '{ "codesToGenerate": 5, "prefix": "US-", "suffix": "-2024", "onlyUniques": true, "charactersSets": [ "ABC", "DEF", "GHI" ] }' \
https://codito.io/free-random-code-generator/api/generate
Response
["US-ADH-2024","US-BDH-2024","US-CFH-2024","US-AEI-2024","US-BFH-2024"]
Generating secure 16 characters long password.
Request
curl --header "Content-Type: application/json" \
--request POST \
--data '{ "codesToGenerate": 1, "onlyUniques": false, "charactersSets": [ "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@", "\\d\\l\\L\\@" ] }' \
https://codito.io/free-random-code-generator/api/generate
Response
["Sr5s88y%Lh!QXdqg"]