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

# Generate Copula Samples

> Generates correlated random samples using various copula models (Gaussian, Student-t, Clayton, Frank, Gumbel, Joe). Copulas model dependency structures between variables while preserving marginal distributions. Essential for multivariate risk modeling, credit portfolio modeling, and Monte Carlo simulations where correlation matters. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/copula/sample
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Risk Module
  description: >-
    Professional-grade risk management endpoints including Value at Risk (VaR),
    stress testing, copulas, extreme value theory (EVT), XVA calculations,
    sensitivities, and portfolio hedging. Part of the Pro Tier (5 credits per
    request).
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
    email: support@fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-risk
    description: Risk Management Module - Pro Tier (5 credits/request)
    x-displayName: Risk
paths:
  /quantlib/risk/copula/sample:
    post:
      tags:
        - quantlib-risk
      summary: Generate Copula Samples
      description: >-
        Generates correlated random samples using various copula models
        (Gaussian, Student-t, Clayton, Frank, Gumbel, Joe). Copulas model
        dependency structures between variables while preserving marginal
        distributions. Essential for multivariate risk modeling, credit
        portfolio modeling, and Monte Carlo simulations where correlation
        matters. [Tier: PRO, Credits: 5]
      operationId: copula_sample
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - copula_type
              properties:
                copula_type:
                  type: string
                  description: Type of copula to use
                  enum:
                    - gaussian
                    - student_t
                    - clayton
                    - frank
                    - gumbel
                    - joe
                  example: student_t
                correlation:
                  type: number
                  description: >-
                    Correlation parameter (for Gaussian/Student-t) or theta
                    parameter (for Archimedean copulas)
                  example: 0.5
                  default: 0.5
                  minimum: -0.99
                  maximum: 0.99
                df:
                  type: integer
                  description: >-
                    Degrees of freedom for Student-t copula (required if
                    copula_type is student_t)
                  example: 5
                  nullable: true
                  minimum: 2
                n_samples:
                  type: integer
                  description: Number of samples to generate
                  example: 1000
                  default: 1000
                  minimum: 100
                seed:
                  type: integer
                  description: Random seed for reproducibility
                  example: 42
                  nullable: true
            example:
              copula_type: clayton
              correlation: 2.5
              n_samples: 5000
              seed: 123
      responses:
        '200':
          description: Copula samples generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      copula:
                        type: string
                        example: clayton
                      n_samples:
                        type: integer
                        example: 5000
                      tail_dependence:
                        type: object
                        description: Upper and lower tail dependence coefficients
                        properties:
                          upper:
                            type: number
                            example: 0
                          lower:
                            type: number
                            example: 0.714
                      sample_preview:
                        type: array
                        description: First 10 samples as [u1, u2] pairs in [0,1]
                        items:
                          type: array
                          items:
                            type: number
                        example:
                          - - 0.234
                            - 0.567
                          - - 0.891
                            - 0.123
              example:
                success: true
                data:
                  copula: clayton
                  n_samples: 5000
                  tail_dependence:
                    upper: 0
                    lower: 0.714
                  sample_preview:
                    - - 0.234
                      - 0.567
                    - - 0.891
                      - 0.123
                    - - 0.456
                      - 0.789
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits for this request
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````