/customers/export v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
Customers
postCustomerExport
Code samples
const inputBody = '{
"type": "object",
"properties": {
"customers": {
"type": "array",
"description": "List of customer MongoDB ObjectIds to export",
"items": {
"type": "string"
}
},
"selectAll": {
"type": "boolean",
"description": "If true, export all customers regardless of the `customers` list"
},
"search": {
"type": "object",
"description": "Optional search filters",
"properties": {
"name": {
"type": "string",
"description": "Filter customers by name (optional)"
}
}
}
},
"required": [
"customers",
"selectAll"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
};
fetch('https://goldleaf.app/api/v1/customers/export',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /customers/export
Export customer data
Export selected customers or all customers based on the selectAll flag. Supports optional filtering by customer name. Accessible to users with admin or regular roles. Access is blocked for users with the customer role.
Body parameter
{
"type": "object",
"properties": {
"customers": {
"type": "array",
"description": "List of customer MongoDB ObjectIds to export",
"items": {
"type": "string"
}
},
"selectAll": {
"type": "boolean",
"description": "If true, export all customers regardless of the `customers` list"
},
"search": {
"type": "object",
"description": "Optional search filters",
"properties": {
"name": {
"type": "string",
"description": "Filter customers by name (optional)"
}
}
}
},
"required": ["customers", "selectAll"]
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | true | none |
| » customers | body | [string] | true | List of customer MongoDB ObjectIds to export |
| » selectAll | body | boolean | true | If true, export all customers regardless of the customers list |
| » search | body | object | false | Optional search filters |
| »» name | body | string | false | Filter customers by name (optional) |
Example responses
200 Response
500 Response
{
"type": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Exported Excel file containing customer data | string |
| 500 | Internal Server Error | Server error | string |
