Rafflify RNG

API Documentation

Learn how to use the Rafflify RNG API

API Overview

The Rafflify RNG API provides a simple way to generate random numbers with customizable parameters. It's designed to be easy to use and integrate into your applications.

Base URL: https://rng-api.rafflify.com

Endpoints

POST

/random-number

Generate a random number within a specified range, with optional exclusions.

Request Body

{
  "start": number,  // Optional, default: 1, min: 1, max: 1,000,000,000
  "end": number,    // Required, min: 1, max: 1,000,000,000
  "exclude": number[]  // Optional, array of numbers to exclude
}
              

Response

{
  "success": boolean,
  "result": number  // The generated random number
}
              

Error Response

{
  "success": false,
  "error": string  // Error message
}
              

Example Usage

JavaScript Example

// Generate a random number between 1 and 100, excluding 50
fetch('https://rng-api.rafflify.com/random-number', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    start: 1,
    end: 100,
    exclude: [50]
  }),
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    console.log('Random number:', data.result);
  } else {
    console.error('Error:', data.error);
  }
})
.catch(error => {
  console.error('Failed to connect to the API:', error);
});
            

cURL Example

curl -X POST https://rng-api.rafflify.com/random-number \
  -H "Content-Type: application/json" \
  -d '{"start": 1, "end": 100, "exclude": [50]}'