> ## 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.

# Upload census file (client portal)

> Create a hidden file record and census report record, then generate a presigned upload URL for uploading a census file. Only works for "Census Data Collection" or "Verify Census File" task types.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /cp/census/_upload
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/census/_upload:
    post:
      tags:
        - client-portal
      summary: Upload census file (client portal)
      description: >-
        Create a hidden file record and census report record, then generate a
        presigned upload URL for uploading a census file. Only works for "Census
        Data Collection" or "Verify Census File" task types.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_cp_census.UploadCensusRequest'
        description: Census upload request (client, task, py, name, size, type required)
        required: true
      responses:
        '200':
          description: File ID and upload URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_cp_census.UploadCensusResponse'
        '400':
          description: Bad request - invalid request body or task not found
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Forbidden - no access to client
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_cp_census.UploadCensusRequest:
      type: object
      properties:
        client:
          type: string
        name:
          type: string
        py:
          type: integer
        size:
          type: integer
        task:
          type: string
        type:
          type: string
    pkg_routes_cp_census.UploadCensusResponse:
      type: object
      properties:
        _id:
          type: string
        upload_url:
          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.