> ## Documentation Index
> Fetch the complete documentation index at: https://alguna.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Credit Grant

Create a new credit grant for a wallet. Credit grants represent individual credit additions with optional expiration.

<ParamField body="wallet_id" type="string" required>
  The wallet ID to grant credits to.
</ParamField>

<ParamField body="amount" type="string" required>
  Amount to grant as a decimal string (e.g., "100.00").
</ParamField>

<ParamField body="description" type="string">
  Optional description of the credit grant.
</ParamField>

<ParamField body="expires_at" type="string">
  Optional ISO 8601 expiration date. Credits expire and become unavailable after this date.
</ParamField>

<ParamField body="payment_id" type="string">
  Optional payment ID if the grant is tied to a payment.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.alguna.io/credit-grants \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "wallet_id": "wal_def456",
      "amount": "500.00",
      "description": "Annual credit allocation",
      "expires_at": "2024-12-31T23:59:59Z"
    }'
  ```

  ```javascript Node.js theme={null}
  const grant = await alguna.creditGrants.create({
    wallet_id: 'wal_def456',
    amount: '500.00',
    description: 'Annual credit allocation',
    expires_at: '2024-12-31T23:59:59Z'
  });
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "grant_abc123",
    "wallet_id": "wal_def456",
    "amount": "500.00",
    "description": "Annual credit allocation",
    "expires_at": "2024-12-31T23:59:59Z",
    "payment_id": null,
    "status": "active",
    "created_at": "2024-01-20T10:00:00Z",
    "updated_at": "2024-01-20T10:00:00Z"
  }
  ```
</ResponseExample>

<ResponseField name="id" type="string">
  Unique identifier for the credit grant.
</ResponseField>

<ResponseField name="wallet_id" type="string">
  The wallet this grant belongs to.
</ResponseField>

<ResponseField name="amount" type="string">
  Grant amount as a decimal string.
</ResponseField>

<ResponseField name="description" type="string">
  Description of the grant.
</ResponseField>

<ResponseField name="expires_at" type="string">
  ISO 8601 expiration date, if set.
</ResponseField>

<ResponseField name="payment_id" type="string">
  Associated payment ID, if any.
</ResponseField>

<ResponseField name="status" type="string">
  Grant status: `active`, `approved`, `pending`, `exhausted`, `expired`, or `voided`.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp of creation.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp of last update.
</ResponseField>
