Skip to main content
POST
/
captive
/
instances
/
{instanceId}
/
coupons
Create coupons
curl --request POST \
  --url https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "minutes_valid": 1440,
  "count": 50
}
'
import requests

url = "https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons"

payload = {
"minutes_valid": 1440,
"count": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({minutes_valid: 1440, count: 50})
};

fetch('https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'minutes_valid' => 1440,
'count' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons"

payload := strings.NewReader("{\n \"minutes_valid\": 1440,\n \"count\": 50\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"minutes_valid\": 1440,\n \"count\": 50\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://v1.api.altostrat.io/captive/instances/{instanceId}/coupons")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"minutes_valid\": 1440,\n \"count\": 50\n}"

response = http.request(request)
puts response.read_body
[
  {
    "id": "b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6",
    "code": "8B7W3D",
    "expires_at": "2025-11-01T12:00:00Z",
    "redeemed_at": null,
    "created_at": "2025-10-29T12:00:00Z"
  }
]
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}

Authorizations

Authorization
string
header
required

API Key authentication. Provide your token in the 'Authorization' header. Example: Authorization: Bearer <YOUR_TOKEN>

Path Parameters

instanceId
string<uuid>
required

The unique identifier for the captive portal instance.

Example:

"9a7f1b2c-3d4e-5f6a-7b8c-9d0e1f2a3b4c"

Body

application/json
minutes_valid
integer
required

The number of minutes from the time of creation that the coupons will be valid for.

Required range: x >= 1
Example:

1440

count
integer
required

The number of coupons to create in this batch.

Required range: 1 <= x <= 200
Example:

50

Response

The coupons were created successfully.

id
string<uuid>

The unique identifier for the coupon.

Example:

"b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6"

code
string

The 6-character alphanumeric code for the coupon.

Example:

"8B7W3D"

expires_at
string<date-time>

The timestamp when the coupon will expire and become invalid.

Example:

"2025-11-01T12:00:00Z"

redeemed_at
string<date-time> | null

The timestamp when the coupon was redeemed. Null if not yet redeemed.

Example:

null

created_at
string<date-time>

The timestamp when the coupon was created.

Example:

"2025-10-29T12:00:00Z"