Guides and Examples
...
Credits
Fetching Account Credit Pools
16 min
this guide explains how to retrieve account credit pool data for a customer using the nue api account credit pools represent a customer's credit balances within specific credit pools prerequisites before you begin, ensure you have a valid nue api key with read permissions customer id for the account you want to query basic understanding of rest apis and json authentication all requests require authentication using your nue api key in the nue api key header const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); endpoint get https //api nue io/customers/{customerid}/account credit pools path parameters parameter type required description customerid string yes the unique identifier of the customer (uuid or salesforce id) query parameters parameter type required description accountpoolids array\[string] no json encoded array of specific account credit pool ids to retrieve page integer no page number for pagination (default 1, minimum 1) limit integer no number of results per page (default 100, range 1 500) basic usage fetch all account credit pools for a customer const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); const customerid = "001rk00001jt2i1yaa"; fetch(`https //api nue io/customers/${customerid}/account credit pools`, { method 'get', headers myheaders }) then(response => response json()) then(result => { if (result status === 'success') { console log(`found ${result pagination total} credit pools`); result data foreach(pool => { console log(`\npool ${pool name}`); console log(` id ${pool id}`); console log(` balance ${pool balance}`); console log(` status ${pool status}`); console log(` credit pool ${pool creditpool name}`); console log(` committed ${pool creditpool committed}`); }); } }) catch(error => console log('error ', error)); fetch specific account credit pools filter by specific pool ids const customerid = "001rk00001jt2i1yaa"; const poolids = \["474935a8 16cc 46a6 927d 74c962cf460f"]; const encodedpoolids = encodeuricomponent(json stringify(poolids)); fetch(`https //api nue io/customers/${customerid}/account credit pools?accountpoolids=${encodedpoolids}`, { method 'get', headers myheaders }) then(response => response json()) then(result => { if (result status === 'success') { result data foreach(pool => { console log(`pool ${pool name}`); console log(` balance ${pool balance}`); console log(` credit type id ${pool credittypeid}`); }); } }) catch(error => console log('error ', error)); paginated retrieval const customerid = "001rk00001jt2i1yaa"; fetch(`https //api nue io/customers/${customerid}/account credit pools?page=1\&limit=10`, { method 'get', headers myheaders }) then(response => response json()) then(result => { if (result status === 'success') { console log(`page ${result pagination page} of ${result pagination totalpages}`); console log(`showing ${result data length} of ${result pagination total} pools`); console log(`has next page ${result pagination hasnext}`); result data foreach(pool => { console log(` ${pool name} ${pool balance} credits`); }); } }) catch(error => console log('error ', error)); response structure success response (200 ok) { "status" "success", "data" \[ { "balance" 240000, "createdbyid" "ddd60c9f e694 4760 b832 f720ebf22a53", "createddate" "2026 01 10t19 12 10 465z", "creditpool" { "committed" true, "createdbyid" "ddd60c9f e694 4760 b832 f720ebf22a53", "createddate" "2026 01 08t02 10 10 259z", "credittypeid" "6984e433 0151 4351 b9e2 b7f557672707", "id" "d3496002 9430 4f8d 9e67 6c6ac8793bd7", "isdefault" false, "lastmodifiedbyid" "ddd60c9f e694 4760 b832 f720ebf22a53", "lastmodifieddate" "2026 01 08t02 10 10 259z", "name" "default committed credit pool" }, "creditpoolid" "d3496002 9430 4f8d 9e67 6c6ac8793bd7", "credittypeid" "6984e433 0151 4351 b9e2 b7f557672707", "customerid" "001rk00001jt2i1yaa", "id" "474935a8 16cc 46a6 927d 74c962cf460f", "lastmodifiedbyid" "ddd60c9f e694 4760 b832 f720ebf22a53", "lastmodifieddate" "2026 01 10t19 13 30 027z", "name" "default committed credit pool", "status" "active" } ], "warnings" \[], "pagination" { "page" 1, "limit" 100, "total" 1, "totalpages" 1, "hasnext" false, "hasprevious" false } } response fields account credit pool object field type description id string unique identifier for the account credit pool name string display name of the account credit pool balance number current credit balance in the pool status string status of the pool (e g , "active") customerid string id of the customer who owns this pool creditpoolid string id of the associated credit pool configuration credittypeid string id of the credit type creditpool object nested credit pool configuration details createddate string iso 8601 timestamp of creation createdbyid string id of the user who created the pool lastmodifieddate string iso 8601 timestamp of last modification lastmodifiedbyid string id of the user who last modified the pool credit pool object (nested) field type description id string unique identifier for the credit pool name string display name of the credit pool committed boolean whether credits are committed/prepaid isdefault boolean whether this is the default credit pool credittypeid string id of the credit type createddate string iso 8601 timestamp of creation lastmodifieddate string iso 8601 timestamp of last modification pagination object field type description page integer current page number limit integer number of results per page total integer total number of results totalpages integer total number of pages hasnext boolean whether there is a next page hasprevious boolean whether there is a previous page error handling common errors error code description resolution customer not found customer id does not exist verify the customer id invalid parameter invalid query parameter format check parameter encoding authentication error invalid or missing api key verify your api key error response example { "status" "failure", "errortype" "not found", "errorcode" "customer not found", "message" "customer with id '001rk00001invalid' was not found " } best practices use pagination for customers with many credit pools to reduce response size filter by pool ids when you only need specific pools to improve performance cache results appropriately since credit pool data changes infrequently handle empty results gracefully customers may not have any credit pools