Units
Fixed-price events, priced FLAT, SLAB or VOLUME. Nothing is deleted — archive instead.
Lists your units. Pass active=true for active ones only.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Query Parameters
true returns only active units.
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/units?active=true"{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "units": [ { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } ] }}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}Creates a unit. The last tier must have upTo: null.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/units" \ -H "Content-Type: application/json" \ -d '{ "name": "API calls", "agentKey": "api_calls", "pricingType": "SLAB", "tiers": [ { "upTo": 1000, "price": 0.01 }, { "upTo": null, "price": 0.005 } ] }'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "created": true, "unit": { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } }}{ "statusCode": 400, "statusDetail": { "status": "ERROR", "message": "Request body must be valid JSON." }, "result": {}}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 409, "statusDetail": { "status": "ERROR", "message": "Customer \"cus_abc123\" is archived." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}Updates only the fields you send.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Path Parameters
Unit id.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Any create fields.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/units/un_5q9w4" \ -H "Content-Type: application/json" \ -d '{ "description": "Billed per request" }'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "updated": true, "unit": { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } }}{ "statusCode": 400, "statusDetail": { "status": "ERROR", "message": "Request body must be valid JSON." }, "result": {}}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 404, "statusDetail": { "status": "ERROR", "message": "No customer with id \"cus_abc123\"." }, "result": {}}{ "statusCode": 409, "statusDetail": { "status": "ERROR", "message": "Customer \"cus_abc123\" is archived." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}Gets one unit.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Path Parameters
Unit id.
Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/units/un_5q9w4"{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "unit": { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } }}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 404, "statusDetail": { "status": "ERROR", "message": "No customer with id \"cus_abc123\"." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}Archives a unit. Nothing is deleted.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Path Parameters
Unit id.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/units/un_5q9w4/archive"{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "archived": true, "unit": { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } }}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 404, "statusDetail": { "status": "ERROR", "message": "No customer with id \"cus_abc123\"." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}Restores an archived unit.
Authorization
apiKey Organisation-scoped key from Settings → API Keys.
In: header
Path Parameters
Unit id.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/units/un_5q9w4/unarchive"{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "unarchived": true, "unit": { "id": "un_5q9w4", "name": "API calls", "agentKey": "api_calls", "description": "string", "pricingType": "SLAB", "flatPrice": 0, "tiers": [ { "id": "tr_1", "upTo": 1000, "price": 0.01, "order": 0 } ], "isActive": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "createdByName": "string" } }}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 404, "statusDetail": { "status": "ERROR", "message": "No customer with id \"cus_abc123\"." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}