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

# Routing - Retrieve Config

> Retrieve active config



## OpenAPI

````yaml get /routing/active
openapi: 3.0.3
info:
  title: Foldd - API Documentation
  description: >

    ## Get started


    Foldd provides a collection of APIs that enable you to process and manage
    payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access Foldd API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

    |---------------|------------------------------------|

    | Sandbox       | <https://sandbox.foldd.com>   |

    | Production    | <https://api.foldd.com>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.foldd.com) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with Foldd server by providing the
    appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

    |-----------------|-----------------------------------------------------------------------------------------------|

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: Foldd Support
    url: https://foldd.com
    email: support@foldd.com
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://sandbox.foldd.com
    description: Sandbox Environment
security: []
tags:
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: Payouts
    description: Create and manage payouts
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
paths:
  /routing/active:
    get:
      tags:
        - Routing
      summary: Routing - Retrieve Config
      description: Retrieve active config
      operationId: Retrieve active config
      parameters:
        - name: profile_id
          in: query
          description: The unique identifier for a merchant profile
          required: false
          schema:
            type: string
            nullable: true
      responses:
        '200':
          description: Successfully retrieved active config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkedRoutingConfigRetrieveResponse'
        '403':
          description: Forbidden
        '404':
          description: Resource missing
        '500':
          description: Internal server error
      security:
        - api_key: []
        - jwt_key: []
components:
  schemas:
    LinkedRoutingConfigRetrieveResponse:
      oneOf:
        - $ref: '#/components/schemas/RoutingRetrieveResponse'
        - type: array
          items:
            $ref: '#/components/schemas/RoutingDictionaryRecord'
    RoutingRetrieveResponse:
      type: object
      description: Response of the retrieved routing configs for a merchant account
      properties:
        algorithm:
          allOf:
            - $ref: '#/components/schemas/MerchantRoutingAlgorithm'
          nullable: true
    RoutingDictionaryRecord:
      type: object
      required:
        - id
        - profile_id
        - name
        - kind
        - description
        - created_at
        - modified_at
      properties:
        id:
          type: string
        profile_id:
          type: string
        name:
          type: string
        kind:
          $ref: '#/components/schemas/RoutingAlgorithmKind'
        description:
          type: string
        created_at:
          type: integer
          format: int64
        modified_at:
          type: integer
          format: int64
        algorithm_for:
          allOf:
            - $ref: '#/components/schemas/TransactionType'
          nullable: true
        decision_engine_routing_id:
          type: string
          nullable: true
    MerchantRoutingAlgorithm:
      type: object
      description: Routing Algorithm specific to merchants
      required:
        - id
        - profile_id
        - name
        - description
        - algorithm
        - created_at
        - modified_at
        - algorithm_for
      properties:
        id:
          type: string
        profile_id:
          type: string
        name:
          type: string
        description:
          type: string
        algorithm:
          $ref: '#/components/schemas/RoutingAlgorithm'
        created_at:
          type: integer
          format: int64
        modified_at:
          type: integer
          format: int64
        algorithm_for:
          $ref: '#/components/schemas/TransactionType'
    RoutingAlgorithmKind:
      type: string
      enum:
        - single
        - priority
        - volume_split
        - advanced
        - dynamic
    TransactionType:
      type: string
      enum:
        - payment
        - payout
    RoutingAlgorithm:
      oneOf:
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - single
            data:
              $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - priority
            data:
              type: array
              items:
                $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - volume_split
            data:
              type: array
              items:
                $ref: '#/components/schemas/ConnectorVolumeSplit'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - advanced
            data:
              $ref: '#/components/schemas/ProgramConnectorSelection'
      description: Routing Algorithm kind
      discriminator:
        propertyName: type
    RoutableConnectorChoice:
      type: object
      description: Routable Connector chosen for a payment
      required:
        - connector
      properties:
        connector:
          $ref: '#/components/schemas/RoutableConnectors'
        merchant_connector_id:
          type: string
          nullable: true
    ConnectorVolumeSplit:
      type: object
      required:
        - connector
        - split
      properties:
        connector:
          $ref: '#/components/schemas/RoutableConnectorChoice'
        split:
          type: integer
          format: int32
          minimum: 0
    ProgramConnectorSelection:
      type: object
      description: |-
        The program, having a default connector selection and
        a bunch of rules. Also can hold arbitrary metadata.
      required:
        - defaultSelection
        - rules
        - metadata
      properties:
        defaultSelection:
          $ref: '#/components/schemas/ConnectorSelection'
        rules:
          $ref: '#/components/schemas/RuleConnectorSelection'
        metadata:
          type: object
          additionalProperties: {}
    RoutableConnectors:
      type: string
      description: >-
        RoutableConnectors are the subset of Connectors that are eligible for
        payments routing
      enum:
        - payper
        - adyenplatform
        - stripe_billing_test
        - phonypay
        - fauxpay
        - pretendpay
        - stripe_test
        - adyen_test
        - checkout_test
        - paypal_test
        - aci
        - adyen
        - airwallex
        - archipel
        - authorizedotnet
        - bankofamerica
        - billwerk
        - bitpay
        - bambora
        - bamboraapac
        - bluesnap
        - boku
        - braintree
        - cashtocode
        - chargebee
        - checkout
        - coinbase
        - coingate
        - cryptopay
        - cybersource
        - datatrans
        - deutschebank
        - digitalvirgo
        - dlocal
        - ebanx
        - elavon
        - facilitapay
        - fiserv
        - fiservemea
        - fiuu
        - forte
        - getnet
        - globalpay
        - globepay
        - gocardless
        - hipay
        - helcim
        - iatapay
        - inespay
        - itaubank
        - jpmorgan
        - klarna
        - mifinity
        - mollie
        - moneris
        - multisafepay
        - nexinets
        - nexixpay
        - nmi
        - nomupay
        - noon
        - novalnet
        - nuvei
        - opennode
        - paybox
        - payme
        - payone
        - paypal
        - paystack
        - payu
        - placetopay
        - powertranz
        - prophetpay
        - rapyd
        - razorpay
        - recurly
        - redsys
        - riskified
        - shift4
        - signifyd
        - square
        - stax
        - stripe
        - stripebilling
        - trustpay
        - tsys
        - volt
        - wellsfargo
        - wise
        - worldline
        - worldpay
        - xendit
        - zen
        - plaid
        - zsl
    ConnectorSelection:
      oneOf:
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - priority
            data:
              type: array
              items:
                $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - volume_split
            data:
              type: array
              items:
                $ref: '#/components/schemas/ConnectorVolumeSplit'
      discriminator:
        propertyName: type
    RuleConnectorSelection:
      type: object
      description: |-
        Represents a rule

        ```text
        rule_name: [stripe, adyen, checkout]
        {
        payment.method = card {
        payment.method.cardtype = (credit, debit) {
        payment.method.network = (amex, rupay, diners)
        }

        payment.method.cardtype = credit
        }
        }
        ```
      required:
        - name
        - connectorSelection
        - statements
      properties:
        name:
          type: string
        connectorSelection:
          $ref: '#/components/schemas/ConnectorSelection'
        statements:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
    IfStatement:
      type: object
      description: >-
        Represents an IF statement with conditions and optional nested IF
        statements


        ```text

        payment.method = card {

        payment.method.cardtype = (credit, debit) {

        payment.method.network = (amex, rupay, diners)

        }

        }

        ```
      required:
        - condition
      properties:
        condition:
          type: array
          items:
            $ref: '#/components/schemas/Comparison'
        nested:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
          nullable: true
    Comparison:
      type: object
      description: Represents a single comparison condition.
      required:
        - lhs
        - comparison
        - value
        - metadata
      properties:
        lhs:
          type: string
          description: >-
            The left hand side which will always be a domain input identifier
            like "payment.method.cardtype"
        comparison:
          $ref: '#/components/schemas/ComparisonType'
        value:
          $ref: '#/components/schemas/ValueType'
        metadata:
          type: object
          description: >-
            Additional metadata that the Static Analyzer and Backend does not
            touch.

            This can be used to store useful information for the frontend and is
            required for communication

            between the static analyzer and the frontend.
          additionalProperties: {}
    ComparisonType:
      type: string
      description: Conditional comparison type
      enum:
        - equal
        - not_equal
        - less_than
        - less_than_equal
        - greater_than
        - greater_than_equal
    ValueType:
      oneOf:
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number
            value:
              $ref: '#/components/schemas/MinorUnit'
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - enum_variant
            value:
              type: string
              description: Represents an enum variant
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - metadata_variant
            value:
              $ref: '#/components/schemas/MetadataValue'
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - str_value
            value:
              type: string
              description: Represents a arbitrary String value
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number_array
            value:
              type: array
              items:
                $ref: '#/components/schemas/MinorUnit'
              description: |-
                Represents an array of numbers. This is basically used for
                "one of the given numbers" operations
                eg: payment.method.amount = (1, 2, 3)
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - enum_variant_array
            value:
              type: array
              items:
                type: string
              description: |-
                Similar to NumberArray but for enum variants
                eg: payment.method.cardtype = (debit, credit)
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number_comparison_array
            value:
              type: array
              items:
                $ref: '#/components/schemas/NumberComparison'
              description: |-
                Like a number array but can include comparisons. Useful for
                conditions like "500 < amount < 1000"
                eg: payment.amount = (> 500, < 1000)
      description: Represents a value in the DSL
      discriminator:
        propertyName: type
    MinorUnit:
      type: integer
      format: int64
      description: This Unit struct represents MinorUnit in which core amount works
    MetadataValue:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
    NumberComparison:
      type: object
      description: Represents a number comparison for "NumberComparisonArrayValue"
      required:
        - comparisonType
        - number
      properties:
        comparisonType:
          $ref: '#/components/schemas/ComparisonType'
        number:
          $ref: '#/components/schemas/MinorUnit'
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: api-key
      description: >-
        Use the API key created under your merchant account from the Foldd
        dashboard. API key is used to authenticate API requests from your
        merchant server only. Don't expose this key on a website or embed it in
        a mobile application.

````