Add Request

Add a transaction or customer merge request

The API lets you create a transaction or a customer merge request.

Customer Merge Request

You can make customer merge requests in standard organizations, organizations with dual eligibility enabled, and connected organizations.

Customer merge requests are defaulted to Pending. Capillary’s backend team reviews the request and either approves or rejects it. However, you can use the client_auto_approve=true query parameter in the API to automatically process the request.

In a connected organization setup, the ability to create customer merge requests depends on where the request originates. Only parent organizations can initiate merge requests. All POST requests to the /v2/requests endpoint from child organizations are blocked. Survivor and victim customers must be registered in the parent organization and all child organizations.

Conditions for Adding Merge Requests in Connected Organizations

Customer merge requests are added to the parent and child organizations based on the presence of both the victim and survivor customers. Use the following rules to determine when to add or ignore the request:

Customer Exists in OrganizationVictim AvailableSurvivor AvailableAction
ParentYesYes Add the request
ChildNoYesIgnore the request
You can't merge if only the survivor exists.
ChildYesNoIgnore the request
You can't merge if only the victim exists.
ChildNoNoIgnore the request
Neither of the customers exists.
ChildYesYesMultiplex and merge the customers
Note: Multiplexing refers to the automatic replication of a merge request from the parent organization to all eligible child organizations.

Note: In a setup with one parent and two or more child organizations, if either the survivor or the victim customer is absent from any organization, the merge request will not be multilexed to that organization.

Prerequisites

  • Authentication - Basic or OAuth authentication
  • Access group resource - Write permission on Requests resource group.

Resource Information

URLv2/requests
HTTP methodPOST
PaginationNA
Rate limitNA
Batch supportNA

API Endpoint Example

https://{host}/v2/requests

Request body parameters for Transaction Request

ParameterTypeDescription
typeStringThe type of the transaction, in this case, "TRANSACTION."
baseTypeStringThe base type of the transaction, in this case, "REGULAR_TXN_ADD."
customerIdentificationInfoObjectContains customer identification information, including the identifier type (externalId), identifier value, and source (INSTORE).
transactionObjectContains details about the transaction, such as type, billing date, bill number, discounts, bill amount, gross amount, delivery status, payment modes, custom fields, and line items.
typeStringThe type of the transaction, in this case, "REGULAR."
billingDateStringThe billing date in ISO 8601 format, e.g., "2022-12-13T11:58:18+05:30."
billNumberStringThe bill number associated with the transaction, e.g., "4113641."
discountStringThe discount amount, e.g., "0."
billAmountStringThe total bill amount, e.g., "21."
noteStringAdditional notes or comments for the transaction, if any.
grossAmountStringThe gross amount of the transaction, e.g., "21."
deliveryStatusStringThe delivery status of the transaction, e.g., "SHIPPED."
paymentModesArrayAn array of objects containing details about the payment modes used in the transaction.
customFieldsObjectContains custom fields related to the transaction, e.g., "paymentmode," "vendor_name," and "added_on."
lineItemsV2ArrayAn array of objects containing details about individual line items in the transaction, including item codes, descriptions, amounts, rates, quantities, and discounts.
imagesArrayAn array of objects representing images related to the transaction, including file names, serial numbers, namespaces, and providers.

Response for Transaction Request

ParameterDescription
createdIdTransaction request id
warningsWarnings, if any.

Request Query Parameter for Customer Merge

Parameter (Parameters marked with * are mandatory)Data TypeDescription
source*StringSource from which the customer is created. Value: INSTORE. Currently, only INSTORE is supported.
client_auto_approveBooleanAutomatically approves the merge request. Default value: false
By default, the system creates all requests with a Pending status. When you set client_auto_approve=true, the request is still created as Pending, but the system automatically processes and updates it to Approved without manual review.
Note: Avoid using the client_auto_approve parameter unless necessary.

Request Body Parameters for Customer Merge

Note: One of the fields marked with ** is mandatory.

Parameter(Parameters marked with * are mandatory)Data TypeDescription
victimCustomer*ObjectDetails of the customer to be removed (victim).
- mobile**StringMobile number of the customer to be merged (victim).
- email**StringEmail address of the customer to be merged.
- externalId**StringExternal ID of the customer to be merged.
- accountId **StringAccount ID of the customer to be merged.
- id**StringCustomer ID of the customer to be merged.
baseType*StringBase type of the request. Use "MERGE" for customer merge.
type*StringType of change. Use "CHANGE_IDENTIFIER" for customer merge.
survivorCustomer*ObjectDetails of the customer to retain (survivor).
- mobile**StringMobile number of the customer to retain.
- email**StringEmail address of the customer to retain.
- externalId**StringExternal ID of the customer to retain.
- accountId**StringAccount ID of the customer to retain.
- id**StringCustomer ID of the customer to retain.
curl --location 'https://eu.api.capillarytech.com/v2/requests?source=INSTORE' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZGllYTI0YTYyZTZm' \
--header 'Cookie: _cfuvid=EWw7Wfz8Ouj54ZVF2cPldbObmSaOCCsfBD._qxSWZoM-1744468652196-0.0.1.1-604800000' \
--data-raw '{
    "victimCustomer": {
        "mobile": "919865398633",
        "email" : "[email protected]"
        
    },
    "baseType": "MERGE",
    "type": "CHANGE_IDENTIFIER",
    "survivorCustomer": {
        "mobile": "919865398634",
        "email": "[email protected]"
       
    }
}'
curl --location 'https://eu.api.capillarytech.com/v2/requests?source=INSTORE' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YXV0b3NTJkMjM0Yjcw' \
--data-raw '{
    "victimCustomer": {
        "mobile": "917569065670",
        "email" : "[email protected]",
        "externalId": "externalId7569065670"
    },
    "baseType": "MERGE",
    "type": "CHANGE_IDENTIFIER",
    "survivorCustomer": {
        "mobile": "918082558297",
        "email": "[email protected]",
        "externalId": "externalId8082558297"
    }
}'
curl --location 'https://eu.api.capillarytech.com/v2/requests?source=INSTORE' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YXVNWI5NjRiMDcxNTJkMjM0Yjcw' \
--data-raw '{
    "victimCustomer": {
        "mobile": "917569065670",
        "email" : "[email protected]",
        "externalId": "externalId7569065670"
    },
    "baseType": "MERGE",
    "type": "CHANGE_IDENTIFIER",
    "survivorCustomer": {
        "mobile": "918082558297",
        "email": "[email protected]",
        "externalId": "externalId8082558297"
    }
}'
curl --location 'https://eu.api.capillarytech.com/v2/requests?source=INSTORE_V2&client_auto_approve=true' \
--header 'Authorization: Basic YNjRiMDcxNTJkMjM0Yjcw' \
--header 'Content-Type: application/json' \
--data '{
    "victimCustomer": {
       "id":"387754951"
    },
    "baseType": "MERGE",
    "type": "CHANGE_IDENTIFIER",
    "survivorCustomer": {
        "id":"387754954"
    }
}'

Response Parameters for Customer Merge

ParameterData TypeDescription
createdIdIntegerUnique ID of the created merge request.
warningsArrayList of warnings, if any, returned by the API.
{
    "createdId": 13030212,
    "warnings": []
}
{
    "createdId": 1778080,
    "warnings": []
}
{
    "errors": [
        {
            "status": false,
            "code": 9021,
            "message": "Request Add/Update is blocked for the org"
        }
    ]
}
{
    "createdId": 1785155,
    "warnings": []
}

Error Code

Error CodeDescription
9021Request Add/Update is blocked for the child organization
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!