curl --request POST \
--url https://api.athenahq.ai/api/v1/groups \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Enterprise Clients",
"website_ids": [
"123e4567-e89b-12d3-a456-426614174000",
"987e6543-e21b-12d3-a456-426614174000"
],
"billing_enabled": false,
"external_id": "acct_9e4c1b8d"
}
'import requests
url = "https://api.athenahq.ai/api/v1/groups"
payload = {
"name": "Enterprise Clients",
"website_ids": ["123e4567-e89b-12d3-a456-426614174000", "987e6543-e21b-12d3-a456-426614174000"],
"billing_enabled": False,
"external_id": "acct_9e4c1b8d"
}
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: 'Enterprise Clients',
website_ids: ['123e4567-e89b-12d3-a456-426614174000', '987e6543-e21b-12d3-a456-426614174000'],
billing_enabled: false,
external_id: 'acct_9e4c1b8d'
})
};
fetch('https://api.athenahq.ai/api/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.athenahq.ai/api/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([
'name' => 'Enterprise Clients',
'website_ids' => [
'123e4567-e89b-12d3-a456-426614174000',
'987e6543-e21b-12d3-a456-426614174000'
],
'billing_enabled' => false,
'external_id' => 'acct_9e4c1b8d'
]),
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.athenahq.ai/api/v1/groups"
payload := strings.NewReader("{\n \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\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.athenahq.ai/api/v1/groups")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.athenahq.ai/api/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 \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\n}"
response = http.request(request)
puts response.read_body{
"group": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Enterprise Clients",
"orgId": "987e6543-e21b-12d3-a456-426614174000",
"billingEnabled": false,
"websiteIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"createdAt": "2024-06-15T10:30:00.000Z",
"externalId": "acct_9e4c1b8d"
},
"billingEntityCreated": true
}Create Group
Creates a new group with associated websites. Requires a global API key. Partner integrations may include an external_id to map their own identifier onto the new Athena group.
curl --request POST \
--url https://api.athenahq.ai/api/v1/groups \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Enterprise Clients",
"website_ids": [
"123e4567-e89b-12d3-a456-426614174000",
"987e6543-e21b-12d3-a456-426614174000"
],
"billing_enabled": false,
"external_id": "acct_9e4c1b8d"
}
'import requests
url = "https://api.athenahq.ai/api/v1/groups"
payload = {
"name": "Enterprise Clients",
"website_ids": ["123e4567-e89b-12d3-a456-426614174000", "987e6543-e21b-12d3-a456-426614174000"],
"billing_enabled": False,
"external_id": "acct_9e4c1b8d"
}
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: 'Enterprise Clients',
website_ids: ['123e4567-e89b-12d3-a456-426614174000', '987e6543-e21b-12d3-a456-426614174000'],
billing_enabled: false,
external_id: 'acct_9e4c1b8d'
})
};
fetch('https://api.athenahq.ai/api/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.athenahq.ai/api/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([
'name' => 'Enterprise Clients',
'website_ids' => [
'123e4567-e89b-12d3-a456-426614174000',
'987e6543-e21b-12d3-a456-426614174000'
],
'billing_enabled' => false,
'external_id' => 'acct_9e4c1b8d'
]),
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.athenahq.ai/api/v1/groups"
payload := strings.NewReader("{\n \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\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.athenahq.ai/api/v1/groups")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.athenahq.ai/api/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 \"name\": \"Enterprise Clients\",\n \"website_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\",\n \"987e6543-e21b-12d3-a456-426614174000\"\n ],\n \"billing_enabled\": false,\n \"external_id\": \"acct_9e4c1b8d\"\n}"
response = http.request(request)
puts response.read_body{
"group": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Enterprise Clients",
"orgId": "987e6543-e21b-12d3-a456-426614174000",
"billingEnabled": false,
"websiteIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"createdAt": "2024-06-15T10:30:00.000Z",
"externalId": "acct_9e4c1b8d"
},
"billingEntityCreated": true
}Body
Request body for creating a new group
Name of the group.
1"Enterprise Clients"
List of website IDs to include in the group. All websites must belong to your organization. Duplicate IDs are collapsed to a single membership.
1[
"123e4567-e89b-12d3-a456-426614174000",
"987e6543-e21b-12d3-a456-426614174000"
]
Whether to enable billing for this group
false
Partner-only. An identifier from your own system to map to this Athena group. Accepted only when authenticating with an API key for an organization flagged as a partner. Sending this field as a direct customer returns 403 Forbidden. Must be unique per resource type within your organization — duplicates return 409 with the existing resource in the payload.
1"acct_9e4c1b8d"
Response
Group created successfully
A newly created group resource
Show child attributes
Show child attributes
Present only when billing_enabled was requested: whether the billing entity exists after provisioning. When false, entity creation failed even after a retry, and setting group credits fails with a 400 until billing is repaired via PATCH /api/v1/groups/{group_id} with billing_enabled: true.
Was this page helpful?