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

# Get credit balance

> Check how many Markifact credits your team has left in the current billing period.

Returns your team's credit position for the current billing period. This is the endpoint to poll if you want to alert before your team runs out.

## Endpoint

```http theme={"dark"}
GET /v1/credits
```

## Example Request

```bash theme={"dark"}
curl "https://api.markifact.com/v1/credits" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

```json theme={"dark"}
{
  "credits_limit": 10000,
  "credits_used": 3613,
  "credits_remaining": 6387,
  "billing_period_end": 1780853312,
  "tier": "team"
}
```

## Fields

| Field                | Type            | Description                                                       |
| -------------------- | --------------- | ----------------------------------------------------------------- |
| `credits_limit`      | integer         | Credits included in your plan for the period.                     |
| `credits_used`       | integer         | Credits consumed so far this period.                              |
| `credits_remaining`  | integer         | `credits_limit` minus `credits_used`. Can be negative, see below. |
| `billing_period_end` | integer or null | When the period ends and usage resets, in Unix seconds.           |
| `tier`               | string          | Your current plan.                                                |

<Note>
  `credits_remaining` can be negative. A run that overshoots the remaining balance is not rolled back mid-execution, so a team can finish a period slightly below zero.
</Note>

## Alerting Example

```bash theme={"dark"}
REMAINING=$(curl -s "https://api.markifact.com/v1/credits" \
  -H "Authorization: Bearer YOUR_API_KEY" | jq '.credits_remaining')

if [ "$REMAINING" -lt 500 ]; then
  echo "Markifact credits low: $REMAINING remaining"
fi
```

To see what consumed the credits, use [List credit logs](/api-reference/credits/list-credit-logs).


## OpenAPI

````yaml GET /v1/credits
openapi: 3.1.0
info:
  title: Markifact API
  version: 1.0.0
  description: API for managing Markifact workspace connections.
servers:
  - url: https://api.markifact.com
security:
  - bearerAuth: []
paths:
  /v1/credits:
    get:
      tags:
        - Credits
      summary: Get credit balance
      description: Current credit balance for the team.
      operationId: getCreditBalance
      responses:
        '200':
          description: Balance returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditBalance'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Team not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreditBalance:
      type: object
      properties:
        credits_limit:
          type: integer
          description: Credits included in the plan for the current period.
        credits_used:
          type: integer
          description: Credits consumed so far this period.
        credits_remaining:
          type: integer
          description: >-
            credits_limit minus credits_used. Can be negative: a run that
            overshoots is not rolled back.
        billing_period_end:
          type:
            - integer
            - 'null'
          format: int64
          description: When the period ends and usage resets, in Unix seconds.
        tier:
          type: string
          description: Current plan.
      required:
        - credits_limit
        - credits_used
        - credits_remaining
        - tier
    Error:
      type: object
      properties:
        detail: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````