> ## Documentation Index
> Fetch the complete documentation index at: https://getprescience.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Replace the census

> Full census replace. Rows are upserted by `email` when present, else by `externalId`. To quote, each member needs `zip` plus one of `dob` | `age`. Valid rows are stored even when other rows fail; check `errors` for per-row rejections. Rate limit: 20 census writes per minute.



## OpenAPI

````yaml /api-reference/openapi.json put /groups/{groupId}/census
openapi: 3.1.0
info:
  title: Prescience Partner API
  version: 1.1.0
  description: >-
    Create employer groups, submit census records, generate indicative quotes,
    create enrollments, and read aggregate account data.


    Money is always integer cents. Dates are `YYYY-MM-DD`; timestamps are ISO
    8601 UTC. Quotes are indicative pending underwriting confirmation. A BAA and
    data processing agreement are executed before live mode is enabled.
  contact:
    name: Prescience partner engineering
    email: partners@getprescience.com
servers:
  - url: https://www.getprescience.com/api/partner/v1
    description: >-
      Production. Test and live traffic share this host; mode comes from your
      API key.
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Connectivity and key checks.
  - name: Plans
    description: Static plan metadata.
  - name: Groups
    description: 'Employer groups: the root resource of every integration.'
  - name: Census
    description: Pre-enrollment census intake and ongoing member sync.
  - name: Quotes
    description: Deterministic, synchronous quotes. Indicative pending underwriting.
  - name: Enrollments
    description: Plan selection and employer provisioning.
  - name: Account
    description: Aggregate, de-identified employer account data.
  - name: Webhooks
    description: Signed event delivery (standard-webhooks scheme).
paths:
  /groups/{groupId}/census:
    put:
      tags:
        - Census
      summary: Replace the census
      description: >-
        Full census replace. Rows are upserted by `email` when present, else by
        `externalId`. To quote, each member needs `zip` plus one of `dob` |
        `age`. Valid rows are stored even when other rows fail; check `errors`
        for per-row rejections. Rate limit: 20 census writes per minute.
      operationId: replaceCensus
      parameters:
        - $ref: '#/components/parameters/GroupId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CensusReplaceRequest'
            example:
              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
      responses:
        '200':
          description: >-
            Census processed. `accepted` rows are stored; `errors` lists
            rejected rows by index.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CensusReplaceResult'
              example:
                groupId: grp_8c2f41d09a3e
                received: 12
                accepted: 12
                memberCount: 12
                errors: []
                warnings: []
        '400':
          description: The payload itself is malformed (not a per-row failure).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: invalid_request
                message: members must be an array.
                details:
                  - field: members
                    message: members must be an array
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    GroupId:
      name: groupId
      in: path
      required: true
      description: Group ID, e.g. `grp_8c2f41d09a3e`.
      schema:
        type: string
        pattern: ^grp_[0-9a-f]{12}$
      example: grp_8c2f41d09a3e
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Any unique string (UUIDs work well). Replaying the same key within 24
        hours returns the stored response instead of re-executing the request.
      schema:
        type: string
        maxLength: 255
      example: 9f3b2c61-4a8d-4e2f-b1c7-d5a90e8f1a23
  schemas:
    CensusReplaceRequest:
      type: object
      required:
        - members
      properties:
        members:
          type: array
          maxItems: 10000
          description: >-
            The full active census. Upsert key is `email` when present, else
            `externalId`. Max 10,000 members, 6 dependents each.
          items:
            $ref: '#/components/schemas/CensusMemberInput'
    CensusReplaceResult:
      type: object
      required:
        - groupId
        - received
        - accepted
        - memberCount
        - errors
        - warnings
      properties:
        groupId:
          type: string
          example: grp_8c2f41d09a3e
        received:
          type: integer
          description: Rows in the request.
          example: 12
        accepted:
          type: integer
          description: Rows stored.
          example: 12
        memberCount:
          type: integer
          description: Members on file after the replace.
          example: 12
        errors:
          type: array
          description: >-
            Per-row rejections. The row at `index` was not stored; everything
            else was.
          items:
            type: object
            required:
              - index
              - field
              - message
            properties:
              index:
                type: integer
                example: 7
              field:
                type: string
                example: zip
              message:
                type: string
                example: zip must be a 5-digit ZIP code
        warnings:
          type: array
          items:
            type: string
          description: >-
            Non-blocking issues, e.g. members missing email (required before
            enrollment, not for quoting).
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          enum:
            - unauthorized
            - live_mode_disabled
            - forbidden
            - not_found
            - invalid_request
            - conflict
            - quote_expired
            - census_required
            - rate_limited
            - server_error
            - not_configured
          description: Stable machine-readable error code.
        message:
          type: string
          description: >-
            Human-readable explanation. Wording may change; branch on `error`,
            not `message`.
        details:
          type: array
          description: Present on `invalid_request`. One entry per failed field.
          items:
            type: object
            required:
              - field
              - message
            properties:
              field:
                type: string
                example: zip
              message:
                type: string
                example: zip must be a 5-digit ZIP code
              index:
                type: integer
                description: >-
                  For array payloads (census rows), the zero-based index of the
                  failing row.
                example: 7
    CensusMemberInput:
      type: object
      required:
        - zip
      anyOf:
        - required:
            - dob
        - required:
            - age
      description: >-
        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.
      properties:
        externalId:
          type: string
          description: Your employee ID. Used as the upsert key when `email` is absent.
          example: emp_0001
        firstName:
          type: string
          example: Jordan
        lastName:
          type: string
          example: Reyes
        email:
          type: string
          format: email
          description: Upsert key when present.
          example: jordan@acme.com
        dob:
          type: string
          format: date
          example: '1992-03-14'
        age:
          type: integer
          description: Alternative to `dob`. One of the two is required.
          example: 34
        zip:
          type: string
          pattern: ^[0-9]{5}$
          description: 5-digit home ZIP. Drives the area factor in rating.
          example: '94110'
        sexAtBirth:
          type: string
          enum:
            - male
            - female
            - other
        employmentType:
          type: string
          enum:
            - full_time
            - part_time
            - contractor
        hireDate:
          type: string
          format: date
          example: '2024-03-01'
        status:
          type: string
          enum:
            - active
            - terminated
          default: active
        dependents:
          type: array
          maxItems: 6
          items:
            $ref: '#/components/schemas/Dependent'
    Dependent:
      type: object
      required:
        - relationship
      properties:
        relationship:
          type: string
          enum:
            - spouse
            - domestic_partner
            - child
            - other
        dob:
          type: string
          format: date
          example: '2019-10-02'
        name:
          type: string
          example: Mia Fischer
  responses:
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unauthorized
            message: >-
              Provide a valid partner API key as `Authorization: Bearer
              psk_...`.
    NotFound:
      description: >-
        No such resource in this mode. Test keys only see test resources; live
        keys only see live resources.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: not_found
            message: No group grp_8c2f41d09a3e found.
    RateLimited:
      description: Rate limit exceeded. Honor `Retry-After`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: rate_limited
            message: Rate limit exceeded. Retry after 12 seconds.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
          example: 12
    ServerError:
      description: >-
        Something failed on our side. Safe to retry with the same
        `Idempotency-Key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: server_error
            message: Internal error. The request was not applied.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        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.

````