Skip to main content
POST
/
v1
/
programs
Create a program
curl --request POST \
  --url https://api.scrip.dev/v1/programs \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "Q1 Sales Bonus",
  "description": "Quarterly sales incentive program for the sales team",
  "on_unknown_participant": "CREATE"
}
'
import requests

url = "https://api.scrip.dev/v1/programs"

payload = {
    "name": "Q1 Sales Bonus",
    "description": "Quarterly sales incentive program for the sales team",
    "on_unknown_participant": "CREATE"
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'Q1 Sales Bonus',
    description: 'Quarterly sales incentive program for the sales team',
    on_unknown_participant: 'CREATE'
  })
};

fetch('https://api.scrip.dev/v1/programs', 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://api.scrip.dev/v1/programs",
  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' => 'Q1 Sales Bonus',
    'description' => 'Quarterly sales incentive program for the sales team',
    'on_unknown_participant' => 'CREATE'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-API-Key: <api-key>"
  ],
]);

$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://api.scrip.dev/v1/programs"

	payload := strings.NewReader("{\n  \"name\": \"Q1 Sales Bonus\",\n  \"description\": \"Quarterly sales incentive program for the sales team\",\n  \"on_unknown_participant\": \"CREATE\"\n}")

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

	req.Header.Add("X-API-Key", "<api-key>")
	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://api.scrip.dev/v1/programs")
  .header("X-API-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Q1 Sales Bonus\",\n  \"description\": \"Quarterly sales incentive program for the sales team\",\n  \"on_unknown_participant\": \"CREATE\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrip.dev/v1/programs")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Q1 Sales Bonus\",\n  \"description\": \"Quarterly sales incentive program for the sales team\",\n  \"on_unknown_participant\": \"CREATE\"\n}"

response = http.request(request)
puts response.read_body
{
  "created_at": "2024-01-15T10:30:00Z",
  "deleted_at": "2024-06-01T00:00:00Z",
  "description": "Quarterly sales incentive program",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Q1 Sales Bonus",
  "on_unknown_participant": "CREATE",
  "redemption_target_entity_id": "550e8400-e29b-41d4-a716-446655440002",
  "redemption_target_type": "SYSTEM_REDEMPTION",
  "status": "ACTIVE",
  "updated_at": "2024-01-15T10:30:00Z"
}
{
  "code": "bad_request",
  "details": {
    "expected": "uuid",
    "field": "asset_id",
    "fields": [
      {
        "expected": "<unknown>",
        "field": "amount",
        "message": "This field is required",
        "reason": "required",
        "received": "-10.00"
      }
    ],
    "reason": "invalid",
    "received": "not-a-uuid"
  },
  "message": "Invalid request parameters"
}
{
  "code": "unauthorized",
  "details": {
    "expected": "uuid",
    "field": "asset_id",
    "fields": [
      {
        "expected": "<unknown>",
        "field": "amount",
        "message": "This field is required",
        "reason": "required",
        "received": "-10.00"
      }
    ],
    "reason": "invalid",
    "received": "not-a-uuid"
  },
  "message": "Missing or invalid credentials"
}
{
  "code": "forbidden",
  "details": {
    "expected": "uuid",
    "field": "asset_id",
    "fields": [
      {
        "expected": "<unknown>",
        "field": "amount",
        "message": "This field is required",
        "reason": "required",
        "received": "-10.00"
      }
    ],
    "reason": "invalid",
    "received": "not-a-uuid"
  },
  "message": "Insufficient permissions for this action"
}
{
  "code": "conflict",
  "details": {
    "expected": "uuid",
    "field": "asset_id",
    "fields": [
      {
        "expected": "<unknown>",
        "field": "amount",
        "message": "This field is required",
        "reason": "required",
        "received": "-10.00"
      }
    ],
    "reason": "invalid",
    "received": "not-a-uuid"
  },
  "message": "Resource already exists or state conflict"
}
{
  "code": "unsupported_media_type",
  "details": {
    "expected": "uuid",
    "field": "asset_id",
    "fields": [
      {
        "expected": "<unknown>",
        "field": "amount",
        "message": "This field is required",
        "reason": "required",
        "received": "-10.00"
      }
    ],
    "reason": "invalid",
    "received": "not-a-uuid"
  },
  "message": "Content-Type must be application/json"
}
{
  "code": "internal_error",
  "message": "An internal error occurred"
}
Creates a new program in your organization. A program only requires a name. By default, on_unknown_participant is set to CREATE, which means participants are auto-created on their first event. Set it to REJECT if you need explicit registration before processing events. Programs start as ACTIVE. You can suspend or archive them later via Update a program.
For usage patterns and examples, see the Programs guide.

Authorizations

X-API-Key
string
header
required

API key passed in the X-API-Key header.

Body

application/json

Program details

name
string
required

Program name

Required string length: 1 - 255
Example:

"Q1 Sales Bonus"

description
string

Optional program description

Maximum string length: 1000
Example:

"Quarterly sales incentive program for the sales team"

on_unknown_participant
enum<string>

How to handle events for unregistered participants. Defaults to CREATE when absent or null; an explicit "" or any non-enum value is rejected.

Available options:
CREATE,
REJECT
Example:

"CREATE"

Response

Program created

created_at
string<date-time>

When the program was created

Example:

"2024-01-15T10:30:00Z"

deleted_at
string<date-time>

Set when the program is archived

Example:

"2024-06-01T00:00:00Z"

description
string

Optional program description

Example:

"Quarterly sales incentive program"

id
string<uuid>

Program ID

Example:

"550e8400-e29b-41d4-a716-446655440000"

name
string

Program name

Example:

"Q1 Sales Bonus"

on_unknown_participant
string

How events for unregistered participants are handled

Example:

"CREATE"

redemption_target_entity_id
string<uuid>

Target ledger entity ID. Present only when redemption_target_type is LEDGER_ENTITY.

Example:

"550e8400-e29b-41d4-a716-446655440002"

redemption_target_type
string

Where redeemed value is posted: SYSTEM_REDEMPTION, SYSTEM_BREAKAGE, or LEDGER_ENTITY

Example:

"SYSTEM_REDEMPTION"

status
string

Lifecycle state

Example:

"ACTIVE"

updated_at
string<date-time>

When the program was last modified

Example:

"2024-01-15T10:30:00Z"