Skip to main content
POST
/
v1
/
groups
Create a group
curl --request POST \
  --url https://api.scrip.dev/v1/groups \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "members": [
    {
      "participant_id": "550e8400-e29b-41d4-a716-446655440000",
      "role": "MEMBER"
    }
  ],
  "name": "Sales Team",
  "on_behalf_of_participant_id": "550e8400-e29b-41d4-a716-446655440010"
}
'
import requests

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

payload = {
"members": [
{
"participant_id": "550e8400-e29b-41d4-a716-446655440000",
"role": "MEMBER"
}
],
"name": "Sales Team",
"on_behalf_of_participant_id": "550e8400-e29b-41d4-a716-446655440010"
}
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({
members: [{participant_id: '550e8400-e29b-41d4-a716-446655440000', role: 'MEMBER'}],
name: 'Sales Team',
on_behalf_of_participant_id: '550e8400-e29b-41d4-a716-446655440010'
})
};

fetch('https://api.scrip.dev/v1/groups', 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/groups",
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([
'members' => [
[
'participant_id' => '550e8400-e29b-41d4-a716-446655440000',
'role' => 'MEMBER'
]
],
'name' => 'Sales Team',
'on_behalf_of_participant_id' => '550e8400-e29b-41d4-a716-446655440010'
]),
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/groups"

payload := strings.NewReader("{\n \"members\": [\n {\n \"participant_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"role\": \"MEMBER\"\n }\n ],\n \"name\": \"Sales Team\",\n \"on_behalf_of_participant_id\": \"550e8400-e29b-41d4-a716-446655440010\"\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/groups")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"members\": [\n {\n \"participant_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"role\": \"MEMBER\"\n }\n ],\n \"name\": \"Sales Team\",\n \"on_behalf_of_participant_id\": \"550e8400-e29b-41d4-a716-446655440010\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"members\": [\n {\n \"participant_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"role\": \"MEMBER\"\n }\n ],\n \"name\": \"Sales Team\",\n \"on_behalf_of_participant_id\": \"550e8400-e29b-41d4-a716-446655440010\"\n}"

response = http.request(request)
puts response.read_body
{
  "created_at": "2024-01-15T10:30:00Z",
  "deleted_at": "2024-06-01T00:00:00Z",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Sales Team",
  "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": "not_found",
"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 not found"
}
{
"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 group with a name and an initial set of members. Each member references an existing participant by ID and is assigned a role of ADMIN or MEMBER. At least one member must have the ADMIN role; the request will fail otherwise. Groups exist at the organization level and can participate across multiple programs. Once created, a group can hold balances, receive events, and be targeted by rules independently of its individual members.
For usage patterns and examples, see the Groups guide.

Authorizations

X-API-Key
string
header
required

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

Body

application/json

Group details with initial members (at least one ADMIN required)

members
object[]
required

Initial members (at least one ADMIN required)

Minimum array length: 1
name
string
required

Display name for the group (1-255 chars)

Required string length: 1 - 255
Example:

"Sales Team"

on_behalf_of_participant_id
string<uuid>

Participant who initiated this change, for audit purposes

Example:

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

Response

Group created with ledger entity

created_at
string<date-time>

When this group was created

Example:

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

deleted_at
string<date-time>

When the group was archived (present only if archived)

Example:

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

id
string<uuid>

Unique identifier for this group

Example:

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

name
string

Display name of the group

Example:

"Sales Team"

status
string

Lifecycle status: ACTIVE or ARCHIVED

Example:

"ACTIVE"

updated_at
string<date-time>

When this group was last updated

Example:

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