Report external usage
POST
/usage/report
const url = 'https://api.banklink.co.za/v1/usage/report';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"endpoint":"/v1/accounts","method":"GET","response_code":200,"invocation_type":"external","invocation_source":"my-service"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.banklink.co.za/v1/usage/report \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "endpoint": "/v1/accounts", "method": "GET", "response_code": 200, "invocation_type": "external", "invocation_source": "my-service" }'Records an external API call for reporting and analytics. Intended for use by external services acting on the organisation’s behalf. This endpoint is not billed.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
endpoint
required
The API endpoint that was called
string
Example
/v1/accountsmethod
required
HTTP method used
string
Example
GETresponse_code
required
HTTP response code returned to the caller
integer
Example
200invocation_type
How the call was invoked (defaults to “external”)
string
Example
externalinvocation_source
Identifier for the originating service or integration
string
Example
my-serviceResponses
Section titled “Responses”Usage recorded
Media typeapplication/json
object
data
required
object
success
required
boolean
Example
{ "data": { "success": true }}Missing required fields
Media typeapplication/json
object
error
required
object
code
required
Machine-readable error code
string
message
required
Human-readable error description
string
Example
{ "error": { "code": "not_found", "message": "Account not found" }}Missing or invalid API key
Media typeapplication/json
object
error
required
object
code
required
Machine-readable error code
string
message
required
Human-readable error description
string
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key" }}