Skip to main content
POST
/
credits
/
migrateToContracts
Migrate plans credit grants to contracts credits and commits.
curl --request POST \
  --url https://api.metronome.com/v1/credits/migrateToContracts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customer_id": "9b85c1c1-5238-4f2a-a409-61412905e1e1",
  "cutover_date": "2024-02-01T00:00:00Z",
  "contract_credits_product_id": "7d21bedf-0f29-4dfe-b5a9-e90888ca46cf",
  "contract_prepaid_commits_product_id": "098bf77f-d6bf-4d08-816f-c9434fdc90fa",
  "contract_credits_priority_override": 0.5,
  "contract_prepaid_commits_priority_override": 0.5,
  "grant_to_contract_commit_mapping": [
    {
      "credit_grant_id": "123e4567-e89b-12d3-a456-426614174000",
      "contract_id": "987fcdeb-51a2-43d1-9b8c-765432109876",
      "product_id": "abc12345-6789-0123-4567-890123456789"
    },
    {
      "credit_grant_id": "456e7890-e89b-12d3-a456-426614174001",
      "contract_id": "654fcdeb-51a2-43d1-9b8c-765432109875",
      "product_id": "def67890-1234-5678-9012-345678901234"
    }
  ],
  "dry_run": false,
  "batch_size": 300
}'
{
  "credit_grants_migrated": 123,
  "has_more": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Parameters for migrating credit grants to contracts.

customer_id
string<uuid>
required

The customer ID to migrate credit grants for.

cutover_date
string<date-time>
required

The date to truncate existing plan credit grants to. This should likely be the end date of the customer's most recently finalized invoice.

contract_credits_product_id
string<uuid>
required

The product ID to use for contract credits.

contract_prepaid_commits_product_id
string<uuid>
required

The product ID to use for contract prepaid commits.

contract_credits_priority_override
number

The priority to use for contract credits.

contract_prepaid_commits_priority_override
number

The priority to use for contract prepaid commits.

grant_to_contract_commit_mapping
object[]

Optional mapping configuration for migrating specific credit grants to contract commits. If not provided, defaults to empty array.

dry_run
boolean

If true, perform a dry run without actually executing the migration. If not provided, defaults to false.

batch_size
number

The number of credit grants to migrate in this batch.

Response

200 - application/json

Success

credit_grants_migrated
number
required

The number of credit grants migrated.

has_more
boolean
required

Whether the customer has more credit grants to migrate.

I