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

# Accept the terms

> Records that the user accepted the terms you showed them: the `version` from GET .../terms, when they accepted and from which IP address. A version that is no longer current is refused; fetch the terms again and show the new ones.



## OpenAPI

````yaml api-reference/users-docs.json POST /api/users/{id}/onboarding/{productCode}/terms
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}/terms:
    post:
      tags:
        - Onboarding
      summary: Accept the terms
      description: >-
        Records that the user accepted the terms you showed them: the `version`
        from GET .../terms, when they accepted and from which IP address. A
        version that is no longer current is refused; fetch the terms again and
        show the new ones.
      parameters:
        - $ref: '#/components/parameters/userIdPathParameter'
        - $ref: '#/components/parameters/productCodePathParameter'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/acceptOnboardingTermsSchema'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/onboardingSchema'
          description: OK
        '400':
          description: The terms changed since that version
          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:
    acceptOnboardingTermsSchema:
      type: object
      properties:
        version:
          type: string
          description: >-
            The `version` from GET .../terms that the user was shown. Required
            when the terms are.
          example: 6689343a7bf5dffb
        acceptedAt:
          type: string
          format: date-time
          description: When the user accepted; now when omitted.
        ip:
          type: string
          description: The user's IP address when they accepted.
          example: 190.12.4.8
    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.