---
title: "Create a credit unit"
description: "Your own unit of credit."
canonical_url: "https://twominutebilling.com/help/developers/api-reference/credits/create-a-credit-unit"
---
# Create a credit unit

> Your own unit of credit.

<api-operation method="POST" path="/v1/businesses/{biz}/credit_units">
<template v-slot:docs="">

The first grant in the unit fixes `currency`, `minor_per_unit` and `decimals`. Needs `credits:manage`.

## Path parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        biz
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The business's id (biz_…).
    </td>
  </tr>
</tbody>
</table>

## Headers

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Idempotency-Key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Safely retry writes — repeats return the original response. If a write FAILED after it had already taken effect, that failure is what repeats: the key is spent, and a new attempt needs a new key.
    </td>
  </tr>
</tbody>
</table>

## Body

The request body is **required**.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      A slug id. If you omit it, we make one from the name.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      Singular.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        plural_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Plural. Default: <code>
        name
      </code>
      
       followed by <code>
        s
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      ISO 4217.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        minor_per_unit
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      Minor units of <code>
        currency
      </code>
      
       per 1 unit, as a decimal string with at most 12 decimal places. For "1 credit = USD 0.01" send <code>
        "1"
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        decimals
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      0 to 4. Default 0.
    </td>
  </tr>
</tbody>
</table>

## Response

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The object type; always <code>
        credit_unit
      </code>
      
      . One of <code>
        credit_unit
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The slug id. Fixed after create.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Singular, for example <code>
        credit
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        plural_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      For example <code>
        credits
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      ISO 4217.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        minor_per_unit
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Minor units of <code>
        currency
      </code>
      
       per 1 unit, as a decimal string with at most 12 decimal places. For "1 credit = USD 0.01" send <code>
        "1"
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        decimals
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      0 to 4. Grant amounts are whole numbers of 10^-decimals units.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        locked
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      True after the first grant in this unit.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        locked_at
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      The locked time (ISO-8601 UTC).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The credit unit's status. One of <code>
        active
      </code>
      
      , <code>
        archived
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      When the credit unit was created (ISO-8601 UTC).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        updated_at
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      When the credit unit was last changed (ISO-8601 UTC).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        resource_version
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      Send as <code>
        expected_version
      </code>
      
       to refuse a stale update.
    </td>
  </tr>
</tbody>
</table>

## Status codes

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        201
      </code>
    </td>
    
    <td>
      The credit unit.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      The body is not correct.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      A credit unit with this id already exists.
    </td>
  </tr>
</tbody>
</table>
</template>

<template v-slot:request="">

```bash [Request]
curl -X POST "$TMBILLING_URL/v1/businesses/biz_XXXXXXXXXXXX01/credit_units" \
  -H "Authorization: Bearer $TMBILLING_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Brightwater Analytics",
    "currency": "USD",
    "minor_per_unit": "month"
  }'
```

</template>

<template v-slot:response="">
<code-group>

```json [201 Created]
{
  "object": "credit_unit",
  "id": "3f6c1b9e-8a2d-4c5e-9f10-2b7d4e6a8c01",
  "name": "Brightwater Analytics",
  "plural_name": "Plural name",
  "currency": "USD",
  "minor_per_unit": "month",
  "decimals": 1,
  "locked": false,
  "locked_at": "2026-03-14T09:30:00Z",
  "status": "active",
  "created_at": "2026-03-14T09:30:00Z",
  "updated_at": "2026-03-14T09:30:00Z",
  "resource_version": 1
}
```

```json [400 Bad Request]
{
  "error": {
    "type": "invalid_request_error",
    "message": "The body is not correct."
  }
}
```

```json [409 Conflict]
{
  "error": {
    "type": "conflict_error",
    "message": "A credit unit with this id already exists."
  }
}
```

</code-group>
</template>
</api-operation>


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
