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

# Save a Census Data Collection v2 section

> Replaces one typed draft section using optimistic revision control and returns server-computed field differences.



## OpenAPI

````yaml /api-reference/cx/swagger.json patch /cp/{client}/tasks/{task}/census-v2/sections/{section}
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /cp/{client}/tasks/{task}/census-v2/sections/{section}:
    patch:
      tags:
        - client-portal
      summary: Save a Census Data Collection v2 section
      description: >-
        Replaces one typed draft section using optimistic revision control and
        returns server-computed field differences.
      parameters:
        - description: Client ID
          name: client
          in: path
          required: true
          schema:
            type: string
        - description: Task ID
          name: task
          in: path
          required: true
          schema:
            type: string
        - description: company, contacts, ownership, or payroll_census
          name: section
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/stax_ai_cx_cx-api_pkg_censusv2.SectionPatchRequest
        description: Revisioned section update
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/stax_ai_cx_cx-api_pkg_censusv2.SectionPatchResponse
        '409':
          description: Revision conflict
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '422':
          description: Section validation failed
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    stax_ai_cx_cx-api_pkg_censusv2.SectionPatchRequest:
      type: object
      properties:
        current_section:
          $ref: '#/components/schemas/sharedtypes.EmployerCensusSection'
        data:
          type: array
          items:
            type: integer
        edited_fields:
          type: array
          items:
            type: string
        revision:
          type: integer
        section_status:
          $ref: '#/components/schemas/sharedtypes.EmployerCensusSectionStatus'
    stax_ai_cx_cx-api_pkg_censusv2.SectionPatchResponse:
      type: object
      properties:
        diffs:
          type: array
          items:
            $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_censusv2.FieldDiff'
        revision:
          type: integer
    sharedtypes.EmployerCensusSection:
      type: string
      enum:
        - company
        - contacts
        - ownership
        - payroll_census
      x-enum-varnames:
        - EmployerCensusSectionCompany
        - EmployerCensusSectionContacts
        - EmployerCensusSectionOwnership
        - EmployerCensusSectionPayrollCensus
    sharedtypes.EmployerCensusSectionStatus:
      type: string
      enum:
        - not_started
        - in_progress
        - completed
      x-enum-varnames:
        - EmployerCensusSectionStatusNotStarted
        - EmployerCensusSectionStatusInProgress
        - EmployerCensusSectionStatusCompleted
    stax_ai_cx_cx-api_pkg_censusv2.FieldDiff:
      type: object
      properties:
        after: {}
        before: {}
        label:
          description: |-
            Label is the path with record ids replaced by names, as the report
            prints it. Only ReadableHistory sets it; it is never stored.
          type: string
        path:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.