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

# Create KYC Link

Generates a direct KYC verification link for an existing user. Redirect the user to this link to complete identity verification with the KYC provider.

***

## Important Notes

* The user must be created first via [Create User](/reference/userpartnercontrollerv2_createuser).
* Each `kycLink` is tied to a unique session. If expired, generate a new link.
* If `partnerRedirectUri` is not provided, the user may not be redirected after completing KYC.
* Supports both HTTPS and custom mobile URI schemes (e.g., `myapp://`).

***

## Use Cases

* **Initiate KYC**: Redirect the user to complete identity verification after account creation.
* **Email or app link**: Embed the `kycLink` in an onboarding email or app screen.
* **Custom redirect**: Use `partnerRedirectUri` to bring the user back to your app after verification.

***

## Error Codes

### Common Errors

| HTTP Status | Code                   | Message                            |
| ----------- | ---------------------- | ---------------------------------- |
| 401         | `UNAUTHORIZED`         | "API Key is missing"               |
| 401         | `UNAUTHORIZED`         | "Invalid API Key format"           |
| 401         | `UNAUTHORIZED`         | "Invalid API Key"                  |
| 403         | `INVALID_PARTNER_FLOW` | "The partner has an invalid flow." |

### User Ownership Errors

| HTTP Status | Code           | Message                                              |
| ----------- | -------------- | ---------------------------------------------------- |
| 401         | `UNAUTHORIZED` | "Partner information is required for this operation" |
| 401         | `UNAUTHORIZED` | "User is not associated with the partner"            |

### Endpoint-Specific Errors

| HTTP Status | Code                                 | Message                                                 |
| ----------- | ------------------------------------ | ------------------------------------------------------- |
| 400         | `INVALID_USER_INPUT_ERROR`           | "Invalid User Input"                                    |
| 400         | `INVALID_VERIFICATION_TYPE_FOR_USER` | "{userType} users can only request {type} verification" |
| 400         | `KYC_TEMPLATE_NOT_CONFIGURED_ERROR`  | "KYC template not configured for {country}"             |
| 404         | `NOT_FOUND_ERROR`                    | "Requested User was not found"                          |
| 500         | `INTERNAL_SERVER_ERROR`              | "Failed to create verification link"                    |


## OpenAPI

````yaml reference/openapi/UserPartnerControllerV2_createVerificationLink.json POST /api/partner/v2/users/{userId}/kyc/verification-link
openapi: 3.0.0
info:
  title: Capa Partner API - V2
  description: >-
    Partner API for integrating cryptocurrency on-ramp and off-ramp services
    using Capa's infrastructure. Enable your users to seamlessly convert between
    fiat and crypto.
  version: v2
  contact: {}
servers:
  - url: https://staging-api.capa.fi
  - url: https://production-api.capa.fi
security: []
paths:
  /api/partner/v2/users/{userId}/kyc/verification-link:
    post:
      tags:
        - users
      operationId: UserPartnerControllerV2_createVerificationLink
      parameters:
        - name: userId
          required: true
          in: path
          description: The user ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                country:
                  description: >-
                    The country code for the partner


                    @description The country must be a valid ISO 3166-1 alpha-2
                    country code, see:

                    @link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
                  example: MX
                  enum:
                    - MX
                    - DO
                    - US
                    - AT
                    - BE
                    - BG
                    - HR
                    - CY
                    - CZ
                    - DK
                    - EE
                    - FI
                    - FR
                    - DE
                    - GR
                    - HU
                    - IE
                    - IT
                    - LV
                    - LT
                    - LU
                    - MT
                    - NL
                    - PL
                    - PT
                    - RO
                    - SK
                    - SI
                    - ES
                    - SE
                    - IS
                    - LI
                    - 'NO'
                    - CH
                    - GB
                    - MC
                    - SM
                    - AD
                    - VA
                  type: string
                partnerRedirectUri:
                  type: string
                  description: >-
                    The redirect URI for the partner to redirect the user after
                    the KYC process is completed
              required:
                - country
              x-readme-ref-name: CreateVerificationLinkBody
      responses:
        '201':
          description: >-
            KYC verification link generated successfully. Returns the URL the
            user must visit to complete verification.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      kycLink:
                        type: string
                        description: The direct link to the KYC provider.
                    required:
                      - kycLink
                    x-readme-ref-name: GetPartnerDirectLinkHttpResponse
              example:
                success: true
                data:
                  kycLink: string
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                INVALID_USER_INPUT_ERROR:
                  value:
                    success: false
                    code: INVALID_USER_INPUT_ERROR
                    message: Invalid User Input
                INVALID_VERIFICATION_TYPE_FOR_USER:
                  value:
                    success: false
                    code: INVALID_VERIFICATION_TYPE_FOR_USER
                    message: BUSINESS users can only request KYB verification
                BAD_REQUEST:
                  value:
                    success: false
                    code: BAD_REQUEST
                    message: Provided url {url} is not valid
                KYC_TEMPLATE_NOT_CONFIGURED_ERROR:
                  value:
                    success: false
                    code: KYC_TEMPLATE_NOT_CONFIGURED_ERROR
                    message: KYC template not configured for {country}
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                UNAUTHORIZED:
                  value:
                    success: false
                    code: UNAUTHORIZED
                    message: API Key is missing
                UNAUTHORIZED_2:
                  value:
                    success: false
                    code: UNAUTHORIZED
                    message: Invalid API Key format
                UNAUTHORIZED_3:
                  value:
                    success: false
                    code: UNAUTHORIZED
                    message: Invalid API Key
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NOT_FOUND_ERROR:
                  value:
                    success: false
                    code: NOT_FOUND_ERROR
                    message: Requested resource was not found
                NOT_FOUND_ERROR_2:
                  value:
                    success: false
                    code: NOT_FOUND_ERROR
                    message: >-
                      Requested Legal entity for country: {country} was not
                      found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                code: INTERNAL_SERVER_ERROR
                message: Internal server error
      security:
        - PartnerApiKey: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable error message.
        errors:
          type: array
          description: Optional per-field validation details.
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
      required:
        - success
        - code
        - message
  securitySchemes:
    PartnerApiKey:
      type: apiKey
      in: header
      name: partner-api-key
      description: API key for the affiliated partner performing the request.

````