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

# Transaction

> Once the above steps have been completed, you may proceed to upload your transactions into Athena for screening. Please note that once transactions are uploaded into Athena, screening will be done **immediately**.

To upload your transactions into Athena, perform the following API call with the given sample request bodies.

**Transaction type must conform to one of the following types**

* PAY
* WITHDRAW
* DEPOSIT

**Requirements before posting a transaction**

* cp\_a\_id and cp\_b\_id needs to be one of the Subjects enrolled via the Subjects API.
* If transaction\_type is PAY, both cp\_a\_id and cp\_b\_id must be present.
* If transaction\_type is DEPOSIT, at least cp\_b\_id must be present.
* If transaction\_type is WITHDRAW, at least cp\_a\_id needs to be present.
* transaction\_currency\_id must be the currency set as the master currency..
* cp\_a\_country and cp\_b\_country, where provided, must be a valid three letter country code.
* transaction\_timestamp cannot be dated in the future.
* If provided, the “populate\_buckets” field must contain a list of bucket names, all of which are available at the time of transaction upload. Otherwise, the record will be rejected and not provided to Athena.

**transaction\_timestamp must conform to one of the following time formats**

* 2020-08-20T13:31:02.777 (YYYY-MM-DDTHH:MM:SS.SSS)
* 2020-08-20T13:31:02 (YYYY-MM-DDTHH:MM:SS)
* 2020-08-20T13:31 (YYYY-MM-DDTHH:MM)

**Sample Request Body (Mandatory Fields):**

```bash theme={null}
{
	"transaction_currency_id":"SGD"
	"client_transaction_id":"SAMPLE-TXN-001",
	"transaction_type":"PAY",
	"cp_a_id":"AS0001Y"
	"cp_b_id":"AS0002Y"
	"transaction_timestamp":"2020-12-12T12:12:12"
	"amount":"5000.00"
}
```

**Sample Request (All Fields):**

```bash theme={null}
{
     "client_transaction_id":"ID10001",
     "transaction_type":"PAY",
     "cp_a_id":"AS001Y",
     "cp_a_country": "SGP",
     "cp_a_bank": "DBS Bank Pte. Ltd",
     "cp_b_id":"AS002Y",
     "cp_b_country": "SGP",
     "cp_b_bank": "DBS Bank Pte. Ltd",
     "transaction_timestamp":"2020-08-20T13:31",
     "transaction_currency_id":"SGD",
     "amount":123456.78,
     "alt_currency_id":"IDR",
     "amount_in_alt_currency":"500000",
     "payment_mode":"PayLah",
     “purpose_of_transfer”: “Purchase of goods”,
     "populate_buckets":["BucketName1","sampleBucket","anotherBucketName"]
}
```

**Note**: For cp\_a\_country and cp\_b\_country, it must be a valid three letter country code. Please refer to the link below.

[ISO 3166 - 3 Digit Code and Full Country Spelling](https://www.iso.org/obp/ui/#search/code/)

###


## OpenAPI

````yaml post /api/transactions
openapi: 3.0.3
info:
  title: Athena API
  version: v3
  x-logo:
    url: https://cynopsis.co/wp-content/uploads/2021/03/logo-2.png
    altText: Cynopsis Solutions
  description: >-
    ATHENA is an advanced real-time transaction monitoring solution designed to
    detect and prevent money laundering, fraud, and terrorism financing. Powered
    by proprietary AML rules, ATHENA analyzes transactions in real time,
    providing clear, intuitive visual insights to streamline compliance
    processes.
        
        ✅ Real-Time Monitoring – Instantly analyzes transaction data to detect anomalies and potential compliance risks.
        ✅ Visualized Insights – Converts complex data into easy-to-understand charts, aiding faster decision-making.
        ✅ Seamless Integration – Easily integrates with existing financial and compliance systems.
        
        Ideal for financial institutions, fintech companies, and regulated businesses, ATHENA enhances risk management and ensures regulatory compliance with ease.
  contact:
    email: tech@cynopsis.co
servers:
  - url: http://localhost/api
    description: Local development server
security: []
paths:
  /api/transactions:
    post:
      tags:
        - Transactions
      summary: Create a transaction
      operationId: transaction_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TransactionRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TransactionRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
          description: ''
      security:
        - CustomAuthentication: []
        - cookieAuth: []
        - BearerAuth: []
components:
  schemas:
    TransactionRequest:
      type: object
      description: |-
        A ModelSerializer that takes an additional `fields` argument that
        controls which fields should be displayed.
      properties:
        populate_buckets:
          type: array
          items:
            type: string
            minLength: 1
          writeOnly: true
          default: []
        cp_a_id:
          type: string
          writeOnly: true
          minLength: 1
        cp_b_id:
          type: string
          writeOnly: true
          minLength: 1
        transaction_currency_id:
          type: string
          writeOnly: true
          minLength: 1
        alt_currency_id:
          type: string
          writeOnly: true
          minLength: 1
        client_transaction_id:
          type: string
          minLength: 1
          maxLength: 255
        transaction_type:
          type: string
          minLength: 1
          maxLength: 255
        cp_a_country:
          type: string
          maxLength: 60
        cp_b_country:
          type: string
          maxLength: 60
        transaction_timestamp:
          type: string
          format: date-time
        amount:
          type: number
          format: double
        cp_a_bank:
          type: string
          maxLength: 255
        cp_b_bank:
          type: string
          maxLength: 255
        amount_in_alt_currency:
          type: number
          format: double
          nullable: true
        payment_mode:
          type: string
          maxLength: 255
        purpose_of_transfer:
          type: string
          maxLength: 255
        notes:
          type: string
          maxLength: 255
      required:
        - amount
        - client_transaction_id
        - transaction_currency_id
        - transaction_timestamp
        - transaction_type
    Transaction:
      type: object
      description: |-
        A ModelSerializer that takes an additional `fields` argument that
        controls which fields should be displayed.
      properties:
        id:
          type: integer
          readOnly: true
        bucket_loading_status:
          type: string
          readOnly: true
          default: Transaction loaded into [ORDINARY] and requested buckets
        cp_a:
          allOf:
            - $ref: '#/components/schemas/Subject'
          readOnly: true
        cp_b:
          allOf:
            - $ref: '#/components/schemas/Subject'
          readOnly: true
        transaction_currency:
          allOf:
            - $ref: '#/components/schemas/Currency'
          readOnly: true
        alt_currency:
          allOf:
            - $ref: '#/components/schemas/Currency'
          readOnly: true
        modified_by:
          allOf:
            - $ref: '#/components/schemas/UserSimpleList'
          readOnly: true
        created_by:
          allOf:
            - $ref: '#/components/schemas/UserSimpleList'
          readOnly: true
        client_transaction_id:
          type: string
          maxLength: 255
        transaction_type:
          type: string
          maxLength: 255
        cp_a_country:
          type: string
          maxLength: 60
        cp_b_country:
          type: string
          maxLength: 60
        transaction_timestamp:
          type: string
          format: date-time
        amount:
          type: number
          format: double
        cp_a_bank:
          type: string
          maxLength: 255
        cp_b_bank:
          type: string
          maxLength: 255
        amount_in_alt_currency:
          type: number
          format: double
          nullable: true
        payment_mode:
          type: string
          maxLength: 255
        purpose_of_transfer:
          type: string
          maxLength: 255
        notes:
          type: string
          maxLength: 255
      required:
        - alt_currency
        - amount
        - bucket_loading_status
        - client_transaction_id
        - cp_a
        - cp_b
        - created_by
        - id
        - modified_by
        - transaction_currency
        - transaction_timestamp
        - transaction_type
    Subject:
      type: object
      properties:
        client_subject_id:
          type: string
          maxLength: 255
        subject_name:
          type: string
          maxLength: 255
        unique_identification_number:
          type: string
          maxLength: 255
        account_holder:
          type: boolean
          nullable: true
        address:
          type: string
          maxLength: 255
        customer_segment:
          type: string
          maxLength: 255
        date_and_place_of_birth:
          type: string
          maxLength: 255
        country_of_birth_or_incorporation:
          type: string
          maxLength: 255
        nationality:
          type: string
          maxLength: 60
        account_type:
          type: string
          maxLength: 255
        account_type_ii:
          type: string
          maxLength: 255
        account_opening_date:
          type: string
          maxLength: 255
        account_opening_date_ii:
          type: string
          maxLength: 255
        customer_aml_risk_rating:
          type: string
          maxLength: 255
        customer_account:
          type: string
          maxLength: 255
        customer_account_ii:
          type: string
          maxLength: 255
        customer_opening_date:
          type: string
          maxLength: 255
        source_of_funds:
          type: string
          maxLength: 255
        average_monthly_income:
          type: string
          maxLength: 255
        cif_status:
          type: string
          maxLength: 255
        occupation:
          type: string
          maxLength: 255
        industry:
          type: string
          maxLength: 255
        purpose_of_account:
          type: string
          maxLength: 255
        contact_number:
          type: string
          maxLength: 255
        email_address:
          type: string
          maxLength: 255
        risk_assessment_score:
          type: string
          format: decimal
          pattern: ^-?\d{0,3}(?:\.\d{0,2})?$
        created_by:
          type: integer
          nullable: true
        modified_by:
          type: integer
          nullable: true
      required:
        - client_subject_id
        - subject_name
    Currency:
      type: object
      properties:
        currency:
          type: string
          maxLength: 65
        alphabetic_code:
          type: string
          maxLength: 3
        numeric_code:
          type: string
          maxLength: 3
        active_indicator:
          type: boolean
          readOnly: true
      required:
        - active_indicator
        - alphabetic_code
        - currency
    UserSimpleList:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
      required:
        - id
  securitySchemes:
    CustomAuthentication:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token obtained from AWS Cognito or custom authentication service
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid

````