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

# Send answers

> Sends answers for the onboarding: a JSON object whose keys are the requirement keys listed under `requirements` (any extra key your own onboarding collected is kept too). Until the onboarding is submitted, sending a key again replaces its earlier value. Once submitted and in review, new keys are still accepted but keys already sent are locked and refused. Sending answers for a product code the user has no onboarding for opens it.



## OpenAPI

````yaml api-reference/users-docs.json PATCH /api/users/{id}/onboarding/{productCode}
openapi: 3.0.0
info:
  version: v2.0.0
  title: Users API
  description: >-
    API for managing users in the Rio platform. A user is created for a product
    code (see GET /api/users/products) and has one onboarding per product code
    under /api/users/{id}/onboarding/{productCode}: send answers, documents and
    the terms acceptance, then submit it for review. Errors are `{ errors: [{
    code, message }] }`; a 503 means a dependency was briefly unavailable and
    nothing changed, so the same call can be retried; a 429 means the request
    allowance was used (see the RateLimit headers); a 409 on submit lists what
    is still missing.
servers:
  - url: https://app.sandbox.rio.trade
security:
  - apiKeyAuth: []
paths:
  /api/users/{id}/onboarding/{productCode}:
    patch:
      tags:
        - Onboarding
      summary: Send answers
      description: >-
        Sends answers for the onboarding: a JSON object whose keys are the
        requirement keys listed under `requirements` (any extra key your own
        onboarding collected is kept too). Until the onboarding is submitted,
        sending a key again replaces its earlier value. Once submitted and in
        review, new keys are still accepted but keys already sent are locked and
        refused. Sending answers for a product code the user has no onboarding
        for opens it.
      parameters:
        - $ref: '#/components/parameters/userIdPathParameter'
        - $ref: '#/components/parameters/productCodePathParameter'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/onboardingAnswersSchema'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/onboardingSchema'
          description: OK
        '400':
          description: >-
            A field already sent, an unknown product code, or a payload over 1
            MB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestErrorSchema'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundErrorSchema'
          description: Not Found
components:
  parameters:
    userIdPathParameter:
      name: id
      in: path
      required: true
      description: ID of the user.
      schema:
        type: string
        format: mongoId
        example: 66562bc04fe8bf83c577c178
    productCodePathParameter:
      name: productCode
      in: path
      required: true
      description: >-
        The product and country the onboarding is for, e.g. `stablecoin-fx-pe`
        (see GET /api/users/products).
      schema:
        type: string
        example: stablecoin-fx-pe
  schemas:
    onboardingAnswersSchema:
      type: object
      description: >-
        Answers by requirement key. Values may be strings, numbers, booleans,
        lists or objects. Keys your own onboarding collected that the product
        does not list are kept too.
      additionalProperties: true
      example:
        tax_id: '10456789012'
        occupation: Consultant
        source_of_funds: salary
        monthly_volume:
          currency: PEN
          amount: 50000
    onboardingSchema:
      type: object
      description: A user's onboarding for one product code.
      properties:
        productCode:
          type: string
          description: 'The product in a country: product id, then country, lowercase.'
          example: stablecoin-fx-pe
        productId:
          type: string
          example: stablecoin-fx
        country:
          type: string
          example: PE
        status:
          type: string
          enum:
            - incomplete
            - submitted
            - approved
            - rejected
          description: >-
            `incomplete` while anything is missing (or after compliance asks for
            more), `submitted` once sent for review, then `approved` or
            `rejected`.
          example: incomplete
        missing:
          type: array
          description: >-
            Requirement keys still outstanding. Empty once the onboarding can be
            submitted.
          items:
            type: string
          example:
            - tax_id
            - proof_of_address
            - terms
        requirements:
          type: array
          description: >-
            Everything the onboarding asks for, required or not, and whether it
            has been received.
          items:
            type: object
            properties:
              key:
                type: string
                description: >-
                  Send the answer under this key (fields), upload the document
                  with this `type` (documents); `terms` and `verification` have
                  their own endpoints.
                example: tax_id
              label:
                type: string
                example: Tax ID
              kind:
                type: string
                enum:
                  - field
                  - document
                  - terms
                  - verification
              required:
                type: boolean
              received:
                type: boolean
        answers:
          type: object
          description: >-
            Every answer received so far, by key. Text longer than 2,000
            characters is cut short.
          additionalProperties: true
          example:
            tax_id: '10456789012'
            occupation: Consultant
        documents:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                example: proof_of_address
              fileName:
                type: string
                example: proof.pdf
              uploadedAt:
                type: string
                format: date-time
        terms:
          type: object
          properties:
            required:
              type: boolean
              description: >-
                False when the product asks for no terms; accepting is then
                optional.
            version:
              type: string
              description: >-
                Send it back when the user accepts. Changes when the terms
                change.
              example: 6689343a7bf5dffb
            url:
              type: string
              description: Page with the full terms, when there is one.
              example: https://rio.trade/terms
            label:
              type: string
              example: Stablecoin FX terms
            text:
              type: string
              description: The terms text (Markdown) to show, when there is one.
            accepted:
              type: boolean
            acceptedAt:
              type: string
              format: date-time
        verification:
          type: object
          properties:
            link:
              type: string
              description: The user's verification link.
            status:
              type: string
              enum:
                - pending
                - completed
                - unavailable
              description: >-
                `pending` until the user completes their session; `unavailable`
                when the verification provider could not be read.
        startedAt:
          type: string
          format: date-time
        submittedAt:
          type: string
          format: date-time
        decidedAt:
          type: string
          format: date-time
    badRequestErrorSchema:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: integer
                example: 2
              message:
                type: string
                example: Invalid input data
            required:
              - code
              - message
      required:
        - errors
    notFoundErrorSchema:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: integer
                example: 1
              message:
                type: string
                example: User not found
            required:
              - code
              - message
      required:
        - errors
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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