List Code Batches
GET /v1/campaigns/codes/batchesReturns a paginated list of code batches for the campaign. Each batch contains metadata about when it was created, how many codes were generated, and their point value.
Authentication
Section titled “Authentication”| Header | Required | Value |
|---|---|---|
X-API-Secret | Yes | Your secret key |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
slug | string | Yes | — | Campaign slug |
page | integer | No | 1 | Page number |
limit | integer | No | 20 | Items per page |
Request Examples
Section titled “Request Examples”curl -X GET "https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10" \ -H "X-API-Secret: sk_live_your_secret_key"const response = await fetch( 'https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10', { headers: { 'X-API-Secret': 'sk_live_your_secret_key' }, });
const data = await response.json();console.log(`${data.data.total} batches total`);data.data.batches.forEach(b => console.log(`${b.label}: ${b.batchSize} codes × ${b.pointsValue} pts`));import requests
response = requests.get( "https://api.gamifyhost.com/v1/campaigns/codes/batches", headers={"X-API-Secret": "sk_live_your_secret_key"}, params={"slug": "summer-promo", "page": 1, "limit": 10},)
data = response.json()for batch in data["data"]["batches"]: print(f"{batch['label']}: {batch['batchSize']} codes × {batch['pointsValue']} pts")import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10")) .header("X-API-Secret", "sk_live_your_secret_key") .GET() .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());req, _ := http.NewRequest("GET", "https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10", nil)req.Header.Set("X-API-Secret", "sk_live_your_secret_key")
resp, err := http.DefaultClient.Do(req)if err != nil { log.Fatal(err)}defer resp.Body.Close()
var result map[string]interface{}json.NewDecoder(resp.Body).Decode(&result)fmt.Println(result["data"])$ch = curl_init('https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10');curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'X-API-Secret: sk_live_your_secret_key', ],]);
$response = curl_exec($ch);curl_close($ch);
$data = json_decode($response, true);foreach ($data['data']['batches'] as $batch) { echo "{$batch['label']}: {$batch['batchSize']} codes × {$batch['pointsValue']} pts\n";}require 'net/http'require 'json'
uri = URI('https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10')req = Net::HTTP::Get.new(uri)req['X-API-Secret'] = 'sk_live_your_secret_key'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }data = JSON.parse(res.body)data['data']['batches'].each do |batch| puts "#{batch['label']}: #{batch['batchSize']} codes × #{batch['pointsValue']} pts"endusing var client = new HttpClient();client.DefaultRequestHeaders.Add("X-API-Secret", "sk_live_your_secret_key");
var response = await client.GetAsync( "https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10");var json = await response.Content.ReadAsStringAsync();Console.WriteLine(json);import 'dart:convert';import 'package:http/http.dart' as http;
final response = await http.get( Uri.parse('https://api.gamifyhost.com/v1/campaigns/codes/batches?slug=summer-promo&page=1&limit=10'), headers: {'X-API-Secret': 'sk_live_your_secret_key'},);
final data = jsonDecode(response.body);for (final batch in data['data']['batches']) { print('${batch['label']}: ${batch['batchSize']} codes × ${batch['pointsValue']} pts');}Response
Section titled “Response”Status: 200 OK
{ "status": "success", "data": { "batches": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "campaignId": "c1d2e3f4-a5b6-7890-1234-567890abcdef", "batchSize": 100, "pointsValue": 500, "label": "In-store promo cards", "expiresAt": "2025-12-31T23:59:59Z", "createdAt": "2025-07-15T10:00:00Z" }, { "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "campaignId": "c1d2e3f4-a5b6-7890-1234-567890abcdef", "batchSize": 50, "pointsValue": 200, "label": "Email campaign July", "expiresAt": null, "createdAt": "2025-07-10T14:30:00Z" } ], "total": 2, "page": 1, "limit": 10 }}Errors
Section titled “Errors”| Code | Message |
|---|---|
404 | Campaign not found |