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

# Validate and save a batch of contracts

> This method sends data and imports contracts in AMLYZE.



## OpenAPI

````yaml /api/openapi_api_adapter.json post /amlyze-ws-rest/batch-contracts
openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
  - url: https://{{baseUrl}}
    description: Generated server url
security:
  - bearerAuth: []
tags: []
paths:
  /amlyze-ws-rest/batch-contracts:
    post:
      tags:
        - contract
      summary: Validate and save a batch of contracts
      description: This method sends data and imports contracts in AMLYZE.
      operationId: batchContracts
      requestBody:
        description: Batch of contracts to validate and save
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchContractsRequestApi'
            examples:
              batch_contract_example:
                summary: Batch contract example
                value:
                  contracts:
                    - action: CREATE
                      communicationNumber: CommNumber0
                      requester: financial_institution
                      businessUnit: sandbox
                      contractType: CREDIT_CARD
                      extId: any_contract_1
                      contractCode: REG74121100
                      customerExtId: ORG20231117550
                    - action: UPDATE
                      communicationNumber: CommNumber1
                      requester: financial_institution
                      businessUnit: sandbox
                      contractType: CREDIT_CARD
                      extId: any_contract_1232
                      contractCode: REG74121101
                      customerExtId: ORG20231117550
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchContractsResponseApi'
              example:
                results:
                  - resultType: REQUEST_ACCEPTED
                    communicationNumber: CommNumber0
                    extId: any_contract_1
                    businessUnit: sandbox
                    timeElapsedMs: 203
                  - resultType: REQUEST_REJECTED
                    communicationNumber: CommNumber1
                    extId: any_contract_2
                    businessUnit: sandbox
                    errorCode: O005
                    errorDescription: CommunicationNumber already used in AMLYZE
                    timeElapsedMs: 20
                timeElapsedMs: 223
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiAdapterErrorResponse'
              example:
                timestamp: '2024-05-26T16:49:50.237+00:00'
                status: 404
                error: Not Found
                path: /amlyze-ws-rest/batch-contracts
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiAdapterErrorResponse'
              example:
                resultType: REQUEST_REJECTED
                status: 500
                error: Internal Server Error
components:
  schemas:
    BatchContractsRequestApi:
      properties:
        contracts:
          items:
            $ref: '#/components/schemas/ContractApi'
          type: array
      type: object
    BatchContractsResponseApi:
      properties:
        results:
          items:
            $ref: '#/components/schemas/BatchContractResultApi'
          type: array
        timeElapsedMs:
          format: int64
          type: integer
      type: object
    ApiAdapterErrorResponse:
      properties:
        errorCode:
          type: string
        errorDescription:
          type: string
        resultType:
          type: string
        errors:
          type: array
          items:
            type: string
        timestamp:
          type: string
        status:
          type: number
        error:
          type: string
        path:
          type: string
    ContractApi:
      properties:
        accountExtId:
          description: >-
            External account identification number. Corresponds to the account's
            identifier in the financial institution.
          type: string
        action:
          description: >-
            Element is used to create/update data of the contract. If not
            provided, `CREATE` is the default. By using `UPDATE`, all existing
            data will be replaced with the newly provided data. This field is
            primarily for batch API usage.
          enum:
            - CREATE
            - UPDATE
          type: string
        active:
          description: Indicates if a contract is active.
          type: boolean
        additionalProperties:
          description: Additional properties for the contract.
          items:
            $ref: '#/components/schemas/ContractAdditionalPropertyApi'
          type: array
        businessUnit:
          description: >-
            Mandatory for clients using a multi-organizational solution.
            Specifies the unique identifier for the business unit.
          type: string
        communicationNumber:
          description: >-
            Unique number of communication. It is used for risk assessment
            callback.
          type: string
        contractCode:
          description: Contract code or number.
          type: string
        contractType:
          description: >-
            Type of contract for evaluation of the object. Possible values are
            configured per client. See `/classifier/contractType`.
          type: string
        customerExtId:
          description: >-
            External customer identifier. This links a contract to a customer
            and corresponds to the client's identifier in the financial
            institution.
          type: string
        endAt:
          description: Contract end date or any other date that covers the ending point.
          format: date
          type: string
        extId:
          description: >-
            Unique external contract identifier. This corresponds to the
            contract identifier in the financial institution.
          type: string
        requester:
          description: Name of the system requesting web service.
          maxLength: 100
          type: string
        startAt:
          description: >-
            Contract start date or any other date that covers the starting
            point.
          format: date
          type: string
      required:
        - communicationNumber
        - extId
        - requester
      type: object
    BatchContractResultApi:
      properties:
        businessUnit:
          type: string
        communicationNumber:
          type: string
        errorCode:
          type: string
        errorDescription:
          type: string
        extId:
          type: string
        resultType:
          enum:
            - REQUEST_ACCEPTED
            - REQUEST_REJECTED
          type: string
        timeElapsedMs:
          format: int64
          type: integer
      type: object
    ContractAdditionalPropertyApi:
      properties:
        at:
          description: The date and time of a property.
          format: date-time
          type: string
        code:
          description: Unique code.
          type: string
        dataType:
          description: Data type.
          enum:
            - BOOLEAN
            - DATE
            - DECIMAL
            - EXTERNAL_LINK
            - INTEGER
            - STRING
            - TIMESTAMP
          type: string
        title:
          type: string
        value:
          type: string
      required:
        - code
        - title
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````