Skip to content

Managing credits

There are several endpoints for credits management in the new V4 version of platform's API. Please follow this link to get detailed information about all endpoints.

Add credits

POST/api/iam/credit

Click to show example shell script
# add credits
data="
{
    "credits": 1.0,
    "billingReference": {"billingReference": "abc123", "billingReferenceTag": "my tag", "billingReferenceType": "EXT"},
    "salesOrderId": "Order12345",
    "expiresAt": "2025-12-31",
    "tenantId": "<uuid>"
}"

curl -k -X POST \
  "https://api.mike-cloud-test.com/api/iam/credit" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer <Bearer token with BackOffice or MIKE Cloud Administrator role>" \
  -d "$data"
Click to show example response
{
    "credits": 1.0
}

Get credits

There are two endpoints to get information about different statuses of credits in the credit management API.

  • GetCreditsByTenant GET/api/iam/credit/{tenantId} returns a breakdown of different credit statuses in the specified tenant (i.e. site).
  • GetCreditsByBillingReference POST/api/iam/credit/unassigned returns a breakdown of different credit statuses that have not been assigned to a tenant (i.e. site). It is recommended to specify a filter if you are interested only in certain statuses and want best performance, e.g. ?filter=Available&filter=Reserved.

Get credits details

These endpoints can be used to get more information about credits, e. g. expiration date or other extended information about project and execution itself. It is recommended to specify a filter if you are interested only in certain statuses and want best performance.

  • POST/api/iam/credit/details returns a breakdown of different credit statuses with expiration dates in the specified tenant (i.e. site).
  • POST/api/iam/credit/unassigned/details returns a breakdown of different credit statuses with expiration dates that have not been assigned to a tenant (i.e. site).
  • POST/api/iam/credit/details/extended returns a breakdown of different credit statuses and detailed information about project and execution in the specified tenant (i.e. site).

Reserve credits

When reserving credits, e.g. before running an engine execution, the endpoint PUT/api/iam/credit/reserve should be used with body like

{
  "credits": 1.23, // number of credits to reserve
  "tenantId": "<uuid>", // tenant id (i.e. site id in which the credits should be reserved)
  "operationId": "<string>" // optional id of the operation to reserve the credits for, e.g. engine execution id
}

Spend credits

There is an endpoint which is internally called by systems that spend credits in the credit management API. PUT/api/iam/credit/spend

Move credits

The credits can be moved between tenant's pools with the same billing reference or between tenant pool and generic pool by calling endpoint PUT/api/iam/credit/move with the body like

{
  "credits": 1.23, // number of credits to move
  "sourceTenantId": "<uuid>", // optional id of pool to be moved from. IF empty then credits will be moved from generic pool.
  "targetTenantId": "<uuid>" // optional id of the pool to be moved to. If empty then the credits will be moved to credit pool.
}
Either source or target pool must be specified.