openapi: 3.0.3
info:
  title: Flinks API
  description: >
    Flinks API provides financial data connectivity, enrichment, and payment
    solutions.


    ## Authentication

    Endpoints require authentication using `flinks-auth-key` header (Bearer
    token).


    For more information, visit: https://docs.flinks.com
  version: 3.0.0
  contact:
    name: Flinks Support
    url: https://www.flinks.com/contact/sales
  termsOfService: https://www.flinks.com
tags:
  - name: Authorization
    description: Endpoints for generating authorization tokens and authenticating requests
  - name: Enrich - Consumer Attributes
    description: Consumer financial attribute analysis and credit risk assessment
servers:
  - url: https://{instance}-api.private.fin.ag
    description: Flinks Upload API
    variables:
      instance:
        default: toolbox
        description: The environment instance (e.g., toolbox, sandbox)
paths:
  /v3/{customerId}/attributes/upload:
    post:
      tags:
        - Upload
      summary: Upload (Base Example)
      description: >-
        Use the standard /Upload endpoint to upload transaction data and receive
        calculated attributes.
      operationId: uploadBase
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: string
          description: >-
            Unique GUID provided by Flinks that grants you access to the
            environment.
        - name: Authorization
          in: header
          description: Bearer Token (API secret key).
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - Origin Country
              properties:
                Card:
                  type: string
                  description: >-
                    Contains the list of Attributes that will be returned for
                    the given set of transactions. (JSON object)
                Origin Country:
                  type: string
                  enum:
                    - ca
                    - us
                  description: >-
                    Tells the API to use a specific country model. Possible
                    values include: - `ca` = Canada - `us` = United States
                MostRecentBalance:
                  type: string
                  description: >
                    The most recent balance for all transactions. Flinks uses
                    this parameter to calculate the running balance if you are
                    not passing the `balance` field in your transaction set or
                    using `OldestBalance`.


                    If you are not using `balance` in the transaction set or
                    `OldestBalance`, this parameter is required.
                OldestBalance:
                  type: string
                  description: >
                    The oldest balance of all transactions. Flinks uses this
                    parameter to calculate the running balance if you are
                    **not** passing the `balance` field in your transaction set
                    or using `MostRecentBalance`.


                    If you are not using `balance` in the transaction set or
                    `MostRecentBalance`, this parameter is required.
                AttributesDetail:
                  type: array
                  items:
                    type: string
                  description: >-
                    List of Attributes that you require the underlying
                    transactions to be returned from. Attribute names included
                    here must also be included in the Attributes list.
                Transactions:
                  type: string
                  description: >-
                    Contains the previously formatted transactions (defined
                    earlier in this documentation) that you are uploading to
                    Flinks. (JSON array of objects)
                Options:
                  type: array
                  items:
                    type: string
                  description: Additional parameters that you want to include.
              example:
                Origin Country: us
      responses:
        '200':
          description: Result
          content:
            application/json:
              schema:
                type: object
                properties:
                  HttpStatusCode:
                    type: integer
                    default: 0
                  Card:
                    type: object
                    properties:
                      sum_debits_30_days:
                        type: integer
                        default: 0
                      AttributesDetail:
                        type: array
                        items:
                          type: object
                          properties:
                            Attribute:
                              type: string
                            Transactions:
                              type: array
                              items:
                                type: object
                                properties:
                                  TransactionId:
                                    type: string
                                  AccountId:
                                    type: string
                                  Date:
                                    type: string
                                  Description:
                                    type: string
                                  Debit:
                                    type: number
                                    default: 0
                                  Credit:
                                    type: number
                                  Balance:
                                    type: number
                                    default: 0
                  requestId:
                    type: string
        '400':
          description: Result
          content:
            application/json:
              schema:
                type: object
  /v3/{customerId}/attributes/upload/AllAttributes:
    post:
      tags:
        - Upload
      summary: Upload (All Attributes Example)
      description: >-
        This endpoint returns all available attributes for the given set of
        transactions.
      operationId: uploadAllAttributes
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: string
          description: >-
            Unique GUID provided by Flinks that grants you access to the
            environment.
        - name: Options
          in: query
          schema:
            type: array
            items:
              type: string
          description: Additional parameters that you want to include.
        - name: Origin Country
          in: query
          schema:
            type: string
            enum:
              - ca
              - us
          description: >-
            Tells the API to use a specific country model. Possible values
            include: - `ca` = Canada - `us` = United States
        - name: MostRecentBalance
          in: query
          schema:
            type: string
          description: >
            The most recent balance for all transactions. Flinks uses this
            parameter to calculate the running balance if you are not passing
            the `balance` field in your transaction set or using
            `OldestBalance`.


            If you are not using `balance` in the transaction set or
            `OldestBalance`, this parameter is required.
        - name: OldestBalance
          in: query
          schema:
            type: string
          description: >
            The oldest balance of all transactions. Flinks uses this parameter
            to calculate the running balance if you are **not** passing the
            `balance` field in your transaction set or using
            `MostRecentBalance`.


            If you are not using `balance` in the transaction set or
            `MostRecentBalance`, this parameter is required.
        - name: Transactions
          in: query
          schema:
            type: array
            items:
              type: string
          description: >-
            Contains the previously formatted transactions (defined earlier in
            this documentation) that you are uploading to Flinks.
        - name: Authorization
          in: header
          description: Bearer Token (API secret key).
          schema:
            type: string
      responses:
        '200':
          description: Result
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Bad Request
  /v3/{customerId}/Categorization/Upload:
    post:
      tags:
        - Upload
      summary: Upload Categorization
      description: >-
        This endpoint will allow your teams to generate Broad Categorization
        Responses from External Data.
      operationId: uploadCategorization
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            Contains the Bearer Token (the API secret key that Flinks provides
            you with).
          schema:
            type: string
            default: Bearer {API Secret}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - OriginCountry
                - Transactions
              properties:
                Options:
                  type: object
                  description: Additional parameters that you want to include.
                OriginCountry:
                  type: string
                  default: us
                  description: >-
                    Tells the API to use a specific country model. Only accepted
                    value is: - `us` = United States
                Transactions:
                  type: array
                  items:
                    type: object
                  description: >-
                    Contains the previously formatted transactions (defined
                    earlier in this documentation) that you are uploading to
                    Flinks.
                UserIdentifier:
                  type: string
                  description: >-
                    UserIdentifier is an optional ID used to identify a request.
                    It replaces the randomly generated GUID value within the
                    Card when it is present and is normally used to map to an ID
                    on your side to relate to the user once a response has been
                    received. It is passed through to the response.
              example:
                OriginCountry: us
                Transactions: []
      responses:
        '200':
          description: Example Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  HttpStatusCode:
                    type: integer
                  LoginId:
                    type: string
                  RequestId:
                    type: string
                  Transactions:
                    type: array
                    items:
                      type: object
                      properties:
                        Description:
                          type: string
                        Category:
                          type: string
                        SubCategory:
                          type: string
                        Debit:
                          type: number
                        Credit:
                          type: number
                        Date:
                          type: string
        '400':
          description: Result
  /v3/{customerId}/upload/fraudanalysis/{loginId}:
    get:
      tags:
        - Upload
      summary: Fraud Analysis
      description: >-
        Use the /FraudAnalysis endpoint if you are using Flinks Upload and want
        to check if our fraud signals were triggered by documents that were
        uploaded.
      operationId: getFraudAnalysis
      parameters:
        - name: Authorization
          in: header
          description: >-
            Contains the Bearer Token (the API secret key that Flinks provides
            you with).
          schema:
            type: string
      responses:
        '200':
          description: Result
          content:
            application/json:
              schema:
                type: object
                properties:
                  HttpStatusCode:
                    type: integer
                  Message:
                    type: string
                    description: >-
                      Message indicating no fraud was detected (e.g., "No Fraud
                      Signal Detected").
                  Login:
                    type: object
                    properties:
                      LoginId:
                        type: string
                        description: The unique identifier for the login.
                      RequestId:
                        type: string
                        description: The unique identifier for the request.
                  DocumentAnalysis:
                    type: array
                    description: Contains the analysis results for the uploaded documents.
                    items:
                      type: object
                      properties:
                        Status:
                          type: string
                          description: >-
                            The status of the document analysis (e.g.,
                            "COMPLETED").
                        FullAnalysis:
                          type: array
                          description: Detailed analysis results.
                          items:
                            type: object
                            properties:
                              DocumentType:
                                type: string
                                description: >-
                                  The type of document analyzed (e.g.,
                                  "BANK_STATEMENT").
                              FraudSignals:
                                type: array
                                description: List of detected fraud signals.
                                items:
                                  type: object
                                  properties:
                                    Type:
                                      type: string
                                      description: The type of fraud signal detected.
                                    PageNumber:
                                      type: integer
                                      description: >-
                                        The page number where the fraud signal
                                        was detected.
                                    Count:
                                      type: integer
                                      description: >-
                                        The number of occurrences of this fraud
                                        signal.
                                    UnderlyingData:
                                      type: array
                                      description: Additional data about the fraud signal.
                                      items:
                                        type: object
                                        properties:
                                          Details:
                                            type: array
                                            description: Specific details about the fraud signal.
                                            items:
                                              type: object
                                              properties:
                                                SpecificType:
                                                  type: string
                                                  description: >-
                                                    The specific type of data (e.g.,
                                                    "delta", "page_number").
                                                Value:
                                                  type: string
                                                  description: The value of the data.
                                                DataType:
                                                  type: string
                                                  description: The data type (e.g., "float", "int").
        '501':
          description: Result
          content:
            application/json:
              schema:
                type: object
                properties:
                  HttpStatusCode:
                    type: integer
                  RequestId:
                    type: string
                    description: The unique identifier for the request.
                  Message:
                    type: string
                    description: Error message describing why the method is not available.
                  FlinksCode:
                    type: string
                    description: Flinks error code (e.g., "METHOD_NOT_AVAILABLE").
components:
  securitySchemes:
    FlinksAuthKey:
      type: apiKey
      in: header
      name: flinks-auth-key
    OptionalApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Optional security feature (must be enabled by Flinks). Contact your
        Flinks representative to activate.
  schemas:
    Login:
      type: object
      description: End user's technical login information
      properties:
        Id:
          type: string
          format: uuid
        Username:
          type: string
        IsScheduledRefresh:
          type: boolean
          default: false
        LastRefresh:
          type: string
          format: date-time
        Type:
          type: string
    Link:
      type: object
      properties:
        rel:
          type: string
          description: Relationship type of the link
        href:
          type: string
          description: Endpoint path
        example:
          type: string
          nullable: true
    SecurityChallenge:
      type: object
      properties:
        Type:
          type: string
          description: Type of security challenge (e.g., QuestionAndAnswer)
          example: QuestionAndAnswer
        Prompt:
          type: string
          description: The security question to present to the user
          example: What shape do people like most?
security: []
