Skip to main content
POST
/
captive
/
instances
/
{instanceId}
/
coupon-schedules
Create a coupon schedule
curl --request POST \
  --url https://v1.api.altostrat.io/captive/instances/{instanceId}/coupon-schedules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Daily Guest Passes",
  "count": 20,
  "recurrence_type": "daily",
  "valid_for_in_minutes": 480,
  "timezone": "Australia/Sydney",
  "notification_group_id": "ng_a1b2c3d4e5f6",
  "day_of_week": 1,
  "day_of_month": 15
}
'
import requests

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

payload = {
"name": "Daily Guest Passes",
"count": 20,
"recurrence_type": "daily",
"valid_for_in_minutes": 480,
"timezone": "Australia/Sydney",
"notification_group_id": "ng_a1b2c3d4e5f6",
"day_of_week": 1,
"day_of_month": 15
}
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({
name: 'Daily Guest Passes',
count: 20,
recurrence_type: 'daily',
valid_for_in_minutes: 480,
timezone: 'Australia/Sydney',
notification_group_id: 'ng_a1b2c3d4e5f6',
day_of_week: 1,
day_of_month: 15
})
};

fetch('https://v1.api.altostrat.io/captive/instances/{instanceId}/coupon-schedules', 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}/coupon-schedules",
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([
'name' => 'Daily Guest Passes',
'count' => 20,
'recurrence_type' => 'daily',
'valid_for_in_minutes' => 480,
'timezone' => 'Australia/Sydney',
'notification_group_id' => 'ng_a1b2c3d4e5f6',
'day_of_week' => 1,
'day_of_month' => 15
]),
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}/coupon-schedules"

payload := strings.NewReader("{\n \"name\": \"Daily Guest Passes\",\n \"count\": 20,\n \"recurrence_type\": \"daily\",\n \"valid_for_in_minutes\": 480,\n \"timezone\": \"Australia/Sydney\",\n \"notification_group_id\": \"ng_a1b2c3d4e5f6\",\n \"day_of_week\": 1,\n \"day_of_month\": 15\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}/coupon-schedules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Daily Guest Passes\",\n \"count\": 20,\n \"recurrence_type\": \"daily\",\n \"valid_for_in_minutes\": 480,\n \"timezone\": \"Australia/Sydney\",\n \"notification_group_id\": \"ng_a1b2c3d4e5f6\",\n \"day_of_week\": 1,\n \"day_of_month\": 15\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"name\": \"Daily Guest Passes\",\n \"count\": 20,\n \"recurrence_type\": \"daily\",\n \"valid_for_in_minutes\": 480,\n \"timezone\": \"Australia/Sydney\",\n \"notification_group_id\": \"ng_a1b2c3d4e5f6\",\n \"day_of_week\": 1,\n \"day_of_month\": 15\n}"

response = http.request(request)
puts response.read_body
{
  "id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "name": "Daily Guest Passes",
  "instance_id": "9a7f1b2c-3d4e-5f6a-7b8c-9d0e1f2a3b4c",
  "count": 20,
  "recurrence_type": "daily",
  "day_of_week": 1,
  "day_of_month": 15,
  "valid_for_in_minutes": 480,
  "timezone": "Australia/Sydney",
  "notification_group_id": "ng_a1b2c3d4e5f6",
  "last_run_at": "2025-10-29T08:00:00Z",
  "next_run_at": "2025-10-30T08:00:00Z",
  "tokens_used_since_last_run": 5,
  "tokens_generated_since_last_run": 20,
  "tokens_available_since_last_run": 15,
  "created_at": "2025-10-20T14:30: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
name
string
required

A human-readable name for the schedule.

Example:

"Daily Guest Passes"

count
integer
required

The number of coupons to generate each time the schedule runs.

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

20

recurrence_type
enum<string>
required

How often the schedule should run.

Available options:
daily,
weekly,
monthly
Example:

"daily"

valid_for_in_minutes
integer
required

The number of minutes each generated coupon will be valid for.

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

480

timezone
string
required

The timezone in which the schedule should be evaluated (e.g., 'America/New_York').

Example:

"Australia/Sydney"

notification_group_id
string
required

The ID of a notification group to receive the generated coupons.

Example:

"ng_a1b2c3d4e5f6"

day_of_week
integer | null

Required for 'weekly' recurrence. The day of the week to run (0=Sunday, 6=Saturday).

Required range: 0 <= x <= 6
Example:

1

day_of_month
integer | null

Required for 'monthly' recurrence. The day of the month to run (1-31).

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

15

Response

The coupon schedule was created successfully.

id
string<uuid>

The unique identifier for the coupon schedule.

Example:

"1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"

name
string

A human-readable name for the schedule.

Example:

"Daily Guest Passes"

instance_id
string<uuid>

The ID of the instance this schedule belongs to.

Example:

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

count
integer

The number of coupons to generate each time the schedule runs.

Example:

20

recurrence_type
enum<string>

How often the schedule should run.

Available options:
daily,
weekly,
monthly
Example:

"daily"

day_of_week
integer | null

Required for 'weekly' recurrence. The day of the week to run (0=Sunday, 6=Saturday).

Example:

1

day_of_month
integer | null

Required for 'monthly' recurrence. The day of the month to run (1-31).

Example:

15

valid_for_in_minutes
integer

The number of minutes each generated coupon will be valid for after its creation.

Example:

480

timezone
string

The timezone in which the schedule should be evaluated (e.g., 'America/New_York').

Example:

"Australia/Sydney"

notification_group_id
string

The ID of a notification group to receive the generated coupons.

Example:

"ng_a1b2c3d4e5f6"

last_run_at
string<date-time> | null

The timestamp of the last time this schedule was successfully run.

Example:

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

next_run_at
string<date-time> | null

The calculated timestamp of the next scheduled run.

Example:

"2025-10-30T08:00:00Z"

tokens_used_since_last_run
integer

The number of coupons from the last run that have been redeemed.

Example:

5

tokens_generated_since_last_run
integer

The total number of coupons generated in the last run.

Example:

20

tokens_available_since_last_run
integer

The number of valid, unredeemed coupons remaining from the last run.

Example:

15

created_at
string<date-time>

The timestamp when the schedule was created.

Example:

"2025-10-20T14:30:00Z"