Skip to main content

Create Account

An account is a combination of a scheme and a company ID, and it is unique for every seller against each scheme they choose. When a seller installs an extension and subscribes to a scheme, this combination becomes an account. An account serves as a placeholder for the company ID, and all data related to serviceability, such as TAT, rate card, and capabilities, are stored against the scheme. For a given account, the DP needs to collect account credentials from the seller through the extension UI to verify and keep track of contracts, charges, and service usage by the seller.

The createCourierPartnerAccount FDK method creates a unique account for a seller against a specific scheme when the seller enables and configures an extension. This account is used to track contracts, service usage, and charges.

Request

In the example request below, an account is created for a seller (identified by companyId: 8948) linked to the specified scheme (scheme_id: Scheme_id_126). The account_id, a combination of the scheme and company ID, ensures the uniqueness of this seller-scheme pairing.

basicRouter.post('/create_seller_account', async function view(req, res, next) {
try {
const partnerClient = await fdkExtension.getPartnerClient('66a0f176a257365a44f33d4c');
const response = await partnerClient.logistics.createCourierPartnerAccount({
"organizationId": organizationId,
"companyId": 8948,
"body": {
"extension_id": process.env.EXTENSION_API_KEY,
"account_id": "Scheme_id_126_company_id_8948",
"scheme_id": "Scheme_id_126",
"is_self_ship": false,
"stage": "enabled",
"is_own_account": true
}
});
console.log(JSON.stringify(response))
res.json(response);
} catch (err) {
console.error(err);
console.log(JSON.stringify(err))
res.status(404).json({ success: false });
}
});

Response

The response confirms the account creation by returning key details such as the account_id, scheme_id, and associated metadata like creation and modification timestamps. It also includes information about the developer who created and modified the account.

{
"company_id": 8948,
"modified_by": {
"first_name": "Logistics_DX104",
"account_type": "system",
"phone_numbers": [],
"updated_at": "2025-01-03T12:17:37.147Z",
"username": "6777d5612f3ce766efa51482",
"firstName": "Logistics_DX104",
"__v": 0,
"debug": {
"platform": "000000000000000000000001",
"source": "grimlock"
},
"active": true,
"emails": [],
"created_at": "2025-01-03T12:17:37.147Z",
"accountType": "system",
"updatedAt": "2025-01-03T12:17:37.147Z",
"status": "active",
"last_name": "Extension Client",
"uid": "23559843",
"password_last_modified": "2025-01-03T12:17:37.147Z",
"password_history": [],
"meta": {
"client_id": "6777d5612f3ce766efa51482",
"client_type": "extension"
},
"lastName": "Extension Client",
"gender": null,
"_id": "72ddedd773a2a3002223bf03",
"phoneNumbers": [],
"createdAt": "2025-01-03T12:17:37.147Z"
},
"scheme_id": "Scheme_id_126",
"account_id": "Scheme_id_126_company_id_8948",
"stage": "enabled",
"is_own_account": true,
"created_by": {
"first_name": "Logistics_DX104",
"account_type": "system",
"phone_numbers": [],
"updated_at": "2025-01-03T12:17:37.147Z",
"username": "6777d5612f3ce766efa51482",
"firstName": "Logistics_DX104",
"__v": 0,
"debug": {
"platform": "000000000000000000000001",
"source": "grimlock"
},
"active": true,
"emails": [],
"created_at": "2025-01-03T12:17:37.147Z",
"accountType": "system",
"updatedAt": "2025-01-03T12:17:37.147Z",
"status": "active",
"last_name": "Extension Client",
"uid": "23559843",
"password_last_modified": "2025-01-03T12:17:37.147Z",
"password_history": [],
"meta": {
"client_id": "6777d5612f3ce766efa51482",
"client_type": "extension"
},
"lastName": "Extension Client",
"gender": null,
"_id": "72ddedd773a2a3002223bf03",
"phoneNumbers": [],
"createdAt": "2025-01-03T12:17:37.147Z"
},
"created_on": "2025-01-09T05:58:18.765183",
"modified_on": "2025-01-09T05:58:18.765226",
"is_self_ship": false,
"extension_id": "6777d5612f3ce766efa51482"
}

Other useful APIs

Update Account

It is used to update account data. Refer to Update Account for more details.

Get Account List of a Company

This API is used to retrieve accounts for a company. Refer to Get DP Accounts for more details.

Get Account Status of a Company

This API is used to retrieve account details for a company from the database. Refer to Get DP Accounts from Database for more details.