Skip to main content
PUT
/
groups
/
{groupId}
/
census
Replace the census
curl --request PUT \
  --url https://www.getprescience.com/api/partner/v1/groups/{groupId}/census \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "members": [
    {
      "externalId": "emp_0001",
      "firstName": "Jordan",
      "lastName": "Reyes",
      "email": "jordan@acme.com",
      "dob": "1992-03-14",
      "zip": "94110",
      "employmentType": "full_time",
      "hireDate": "2024-03-01"
    },
    {
      "externalId": "emp_0008",
      "firstName": "Grace",
      "lastName": "Okafor",
      "email": "grace@acme.com",
      "dob": "1990-07-03",
      "zip": "94110",
      "employmentType": "full_time",
      "hireDate": "2023-07-15",
      "dependents": [
        {
          "relationship": "spouse",
          "dob": "1989-08-12",
          "name": "Femi Okafor"
        }
      ]
    },
    {
      "externalId": "emp_0010",
      "firstName": "Lena",
      "lastName": "Fischer",
      "email": "lena@acme.com",
      "dob": "1993-01-15",
      "zip": "94110",
      "employmentType": "full_time",
      "hireDate": "2024-09-30",
      "dependents": [
        {
          "relationship": "child",
          "dob": "2019-10-02",
          "name": "Mia Fischer"
        }
      ]
    }
  ]
}
'
import requests

url = "https://www.getprescience.com/api/partner/v1/groups/{groupId}/census"

payload = { "members": [
        {
            "externalId": "emp_0001",
            "firstName": "Jordan",
            "lastName": "Reyes",
            "email": "jordan@acme.com",
            "dob": "1992-03-14",
            "zip": "94110",
            "employmentType": "full_time",
            "hireDate": "2024-03-01"
        },
        {
            "externalId": "emp_0008",
            "firstName": "Grace",
            "lastName": "Okafor",
            "email": "grace@acme.com",
            "dob": "1990-07-03",
            "zip": "94110",
            "employmentType": "full_time",
            "hireDate": "2023-07-15",
            "dependents": [
                {
                    "relationship": "spouse",
                    "dob": "1989-08-12",
                    "name": "Femi Okafor"
                }
            ]
        },
        {
            "externalId": "emp_0010",
            "firstName": "Lena",
            "lastName": "Fischer",
            "email": "lena@acme.com",
            "dob": "1993-01-15",
            "zip": "94110",
            "employmentType": "full_time",
            "hireDate": "2024-09-30",
            "dependents": [
                {
                    "relationship": "child",
                    "dob": "2019-10-02",
                    "name": "Mia Fischer"
                }
            ]
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    members: [
      {
        externalId: 'emp_0001',
        firstName: 'Jordan',
        lastName: 'Reyes',
        email: 'jordan@acme.com',
        dob: '1992-03-14',
        zip: '94110',
        employmentType: 'full_time',
        hireDate: '2024-03-01'
      },
      {
        externalId: 'emp_0008',
        firstName: 'Grace',
        lastName: 'Okafor',
        email: 'grace@acme.com',
        dob: '1990-07-03',
        zip: '94110',
        employmentType: 'full_time',
        hireDate: '2023-07-15',
        dependents: [{relationship: 'spouse', dob: '1989-08-12', name: 'Femi Okafor'}]
      },
      {
        externalId: 'emp_0010',
        firstName: 'Lena',
        lastName: 'Fischer',
        email: 'lena@acme.com',
        dob: '1993-01-15',
        zip: '94110',
        employmentType: 'full_time',
        hireDate: '2024-09-30',
        dependents: [{relationship: 'child', dob: '2019-10-02', name: 'Mia Fischer'}]
      }
    ]
  })
};

fetch('https://www.getprescience.com/api/partner/v1/groups/{groupId}/census', 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://www.getprescience.com/api/partner/v1/groups/{groupId}/census",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'members' => [
        [
                'externalId' => 'emp_0001',
                'firstName' => 'Jordan',
                'lastName' => 'Reyes',
                'email' => 'jordan@acme.com',
                'dob' => '1992-03-14',
                'zip' => '94110',
                'employmentType' => 'full_time',
                'hireDate' => '2024-03-01'
        ],
        [
                'externalId' => 'emp_0008',
                'firstName' => 'Grace',
                'lastName' => 'Okafor',
                'email' => 'grace@acme.com',
                'dob' => '1990-07-03',
                'zip' => '94110',
                'employmentType' => 'full_time',
                'hireDate' => '2023-07-15',
                'dependents' => [
                                [
                                                                'relationship' => 'spouse',
                                                                'dob' => '1989-08-12',
                                                                'name' => 'Femi Okafor'
                                ]
                ]
        ],
        [
                'externalId' => 'emp_0010',
                'firstName' => 'Lena',
                'lastName' => 'Fischer',
                'email' => 'lena@acme.com',
                'dob' => '1993-01-15',
                'zip' => '94110',
                'employmentType' => 'full_time',
                'hireDate' => '2024-09-30',
                'dependents' => [
                                [
                                                                'relationship' => 'child',
                                                                'dob' => '2019-10-02',
                                                                'name' => 'Mia Fischer'
                                ]
                ]
        ]
    ]
  ]),
  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://www.getprescience.com/api/partner/v1/groups/{groupId}/census"

	payload := strings.NewReader("{\n  \"members\": [\n    {\n      \"externalId\": \"emp_0001\",\n      \"firstName\": \"Jordan\",\n      \"lastName\": \"Reyes\",\n      \"email\": \"jordan@acme.com\",\n      \"dob\": \"1992-03-14\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-03-01\"\n    },\n    {\n      \"externalId\": \"emp_0008\",\n      \"firstName\": \"Grace\",\n      \"lastName\": \"Okafor\",\n      \"email\": \"grace@acme.com\",\n      \"dob\": \"1990-07-03\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2023-07-15\",\n      \"dependents\": [\n        {\n          \"relationship\": \"spouse\",\n          \"dob\": \"1989-08-12\",\n          \"name\": \"Femi Okafor\"\n        }\n      ]\n    },\n    {\n      \"externalId\": \"emp_0010\",\n      \"firstName\": \"Lena\",\n      \"lastName\": \"Fischer\",\n      \"email\": \"lena@acme.com\",\n      \"dob\": \"1993-01-15\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-09-30\",\n      \"dependents\": [\n        {\n          \"relationship\": \"child\",\n          \"dob\": \"2019-10-02\",\n          \"name\": \"Mia Fischer\"\n        }\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", 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.put("https://www.getprescience.com/api/partner/v1/groups/{groupId}/census")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"members\": [\n    {\n      \"externalId\": \"emp_0001\",\n      \"firstName\": \"Jordan\",\n      \"lastName\": \"Reyes\",\n      \"email\": \"jordan@acme.com\",\n      \"dob\": \"1992-03-14\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-03-01\"\n    },\n    {\n      \"externalId\": \"emp_0008\",\n      \"firstName\": \"Grace\",\n      \"lastName\": \"Okafor\",\n      \"email\": \"grace@acme.com\",\n      \"dob\": \"1990-07-03\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2023-07-15\",\n      \"dependents\": [\n        {\n          \"relationship\": \"spouse\",\n          \"dob\": \"1989-08-12\",\n          \"name\": \"Femi Okafor\"\n        }\n      ]\n    },\n    {\n      \"externalId\": \"emp_0010\",\n      \"firstName\": \"Lena\",\n      \"lastName\": \"Fischer\",\n      \"email\": \"lena@acme.com\",\n      \"dob\": \"1993-01-15\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-09-30\",\n      \"dependents\": [\n        {\n          \"relationship\": \"child\",\n          \"dob\": \"2019-10-02\",\n          \"name\": \"Mia Fischer\"\n        }\n      ]\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://www.getprescience.com/api/partner/v1/groups/{groupId}/census")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"members\": [\n    {\n      \"externalId\": \"emp_0001\",\n      \"firstName\": \"Jordan\",\n      \"lastName\": \"Reyes\",\n      \"email\": \"jordan@acme.com\",\n      \"dob\": \"1992-03-14\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-03-01\"\n    },\n    {\n      \"externalId\": \"emp_0008\",\n      \"firstName\": \"Grace\",\n      \"lastName\": \"Okafor\",\n      \"email\": \"grace@acme.com\",\n      \"dob\": \"1990-07-03\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2023-07-15\",\n      \"dependents\": [\n        {\n          \"relationship\": \"spouse\",\n          \"dob\": \"1989-08-12\",\n          \"name\": \"Femi Okafor\"\n        }\n      ]\n    },\n    {\n      \"externalId\": \"emp_0010\",\n      \"firstName\": \"Lena\",\n      \"lastName\": \"Fischer\",\n      \"email\": \"lena@acme.com\",\n      \"dob\": \"1993-01-15\",\n      \"zip\": \"94110\",\n      \"employmentType\": \"full_time\",\n      \"hireDate\": \"2024-09-30\",\n      \"dependents\": [\n        {\n          \"relationship\": \"child\",\n          \"dob\": \"2019-10-02\",\n          \"name\": \"Mia Fischer\"\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "groupId": "grp_8c2f41d09a3e",
  "received": 12,
  "accepted": 12,
  "memberCount": 12,
  "errors": [],
  "warnings": []
}
{
  "error": "invalid_request",
  "message": "members must be an array.",
  "details": [
    {
      "field": "members",
      "message": "members must be an array"
    }
  ]
}
{
  "error": "unauthorized",
  "message": "Provide a valid partner API key as `Authorization: Bearer psk_...`."
}
{
  "error": "not_found",
  "message": "No group grp_8c2f41d09a3e found."
}
{
  "error": "rate_limited",
  "message": "Rate limit exceeded. Retry after 12 seconds."
}
{
  "error": "server_error",
  "message": "Internal error. The request was not applied."
}

Authorizations

Authorization
string
header
required

Partner API key. psk_test_<32 hex> for test mode, psk_live_<32 hex> for live mode. Keys are stored hashed and cannot be recovered; store them in your secrets manager on issue.

Headers

Idempotency-Key
string

Any unique string (UUIDs work well). Replaying the same key within 24 hours returns the stored response instead of re-executing the request.

Maximum string length: 255

Path Parameters

groupId
string
required

Group ID, e.g. grp_8c2f41d09a3e.

Pattern: ^grp_[0-9a-f]{12}$

Body

application/json
members
object[]
required

The full active census. Upsert key is email when present, else externalId. Max 10,000 members, 6 dependents each.

Maximum array length: 10000

One employee. zip plus one of dob | age is enough to quote. firstName, lastName, and email are additionally required (per active member) at enrollment time.

Response

Census processed. accepted rows are stored; errors lists rejected rows by index.

groupId
string
required
Example:

"grp_8c2f41d09a3e"

received
integer
required

Rows in the request.

Example:

12

accepted
integer
required

Rows stored.

Example:

12

memberCount
integer
required

Members on file after the replace.

Example:

12

errors
object[]
required

Per-row rejections. The row at index was not stored; everything else was.

warnings
string[]
required

Non-blocking issues, e.g. members missing email (required before enrollment, not for quoting).