> ## 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.

# List credit logs

> Read your Markifact team's credit ledger: every charge, what caused it, and who ran it.

Returns one entry per credit charge, newest first. Every workflow run, agent turn, copilot request, and MCP tool call that consumed credits appears here.

Unlike [operation logs](/api-reference/logs/list-logs), the credit ledger is **not truncated by your plan**. Your full history is available so you can reconcile against invoices.

## Endpoint

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

## Query Parameters

| Parameter        | Type    | Required | Description                                                                                                                           |
| ---------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `service_type`   | string  | No       | Filter by what was charged: `workflow`, `agent`, `copilot`, or `mcp`.                                                                 |
| `service_id`     | string  | No       | Charges from one workflow, conversation, or MCP server. Use this for per-client cost allocation.                                      |
| `user_id`        | string  | No       | Charges triggered by one team member.                                                                                                 |
| `created_after`  | integer | No       | Only charges at or after this Unix second.                                                                                            |
| `created_before` | integer | No       | Only charges at or before this Unix second.                                                                                           |
| `limit`          | integer | No       | Entries per page, 1 to 1000. Defaults to 25. Ledger entries carry no payloads, so the ceiling here is higher than on other resources. |
| `cursor`         | string  | No       | The `next_cursor` from the previous page.                                                                                             |

## Example Request

```bash theme={"dark"}
curl "https://api.markifact.com/v1/credits/logs?service_type=workflow&limit=25" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

```json theme={"dark"}
{
  "data": [
    {
      "id": 7934,
      "credits_used": 4,
      "credits_remaining": 6389,
      "service": {
        "type": "workflow",
        "id": "bcd0e853-dd0c-4347-bd35-b86148cf2c96",
        "name": "Meta Ads Upload"
      },
      "user": {
        "id": "Q8Wvn9gL8GUQ11SsJAnMfiyyGOA2",
        "email": "member@example.com"
      },
      "created_at": 1784874205
    }
  ],
  "has_more": true,
  "next_cursor": "eyJzIjoxNzg0ODc0MjA1LCJpIjo3OTM0fQ"
}
```

## Credit Log Object

| Field               | Type    | Description                                                                                          |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `id`                | integer | Ledger entry ID.                                                                                     |
| `credits_used`      | integer | Credits this charge consumed.                                                                        |
| `credits_remaining` | integer | Balance immediately after the charge. See the caveat below.                                          |
| `service`           | object  | What was charged. See below.                                                                         |
| `user`              | object  | The team member who triggered it, with `id` and `email`. Both can be null for system-triggered runs. |
| `created_at`        | integer | Charge time in Unix seconds.                                                                         |

### Service Object

| Field  | Type   | Description                                                                                                                                                                        |
| ------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | string | `workflow`, `agent`, `copilot`, or `mcp`.                                                                                                                                          |
| `id`   | string | The workflow, conversation, or MCP server charged. Matches `source.id` in [operation logs](/api-reference/logs/list-logs).                                                         |
| `name` | string | The name **at the time of the charge**, not the current name. A renamed workflow keeps its old name on historical entries, which is what you want when reconciling a past invoice. |

<Warning>
  `credits_remaining` is a point-in-time snapshot, not a running total you can reproduce by summing `credits_used`.

  The ledger records **consumption only**. When a billing period renews, your balance resets without writing an entry, so two consecutive entries can show the balance jumping upward. Use [Get credit balance](/api-reference/credits/get-balance) for the current figure rather than deriving it from the ledger.
</Warning>

## Pagination

Identical to [operation logs](/api-reference/logs/list-logs#pagination): read `next_cursor` and pass it back as `cursor`. Keep every other parameter unchanged while paging, and treat the cursor as opaque.

## Cost Allocation Example

To total what one workflow cost over a period, filter by its `service_id` and sum:

```bash theme={"dark"}
curl "https://api.markifact.com/v1/credits/logs?service_id=bcd0e853-dd0c-4347-bd35-b86148cf2c96&created_after=1782000000&limit=1000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  | jq '[.data[].credits_used] | add'
```

Page through with `next_cursor` until `has_more` is `false` to cover the whole range. Use `limit=1000` when exporting: a full page is only around 265 KB, so a year of history is a handful of requests rather than hundreds.

<Note>
  Credit charges do not map one-to-one onto operation logs. A single workflow run produces one operation log per node but a single credit entry, and agent and copilot usage is charged at the conversation level. Treat this ledger as the authoritative record of what you were charged.
</Note>


## OpenAPI

````yaml GET /v1/credits/logs
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/logs:
    get:
      tags:
        - Credits
      summary: List credit logs
      description: List the team's credit charges, newest first. Not truncated by plan.
      operationId: listCreditLogs
      parameters:
        - name: service_type
          in: query
          required: false
          schema:
            type: string
            enum:
              - workflow
              - agent
              - copilot
              - mcp
          description: Filter by what was charged.
        - name: service_id
          in: query
          required: false
          schema:
            type: string
          description: Charges from one workflow, conversation, or MCP server.
        - name: user_id
          in: query
          required: false
          schema:
            type: string
          description: Charges triggered by one team member.
        - name: created_after
          in: query
          required: false
          schema:
            type: integer
            format: int64
            minimum: 0
          description: Only charges at or after this Unix second.
        - name: created_before
          in: query
          required: false
          schema:
            type: integer
            format: int64
            minimum: 0
          description: Only charges at or before this Unix second.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 25
          description: >-
            Entries per page. The ceiling is higher than on other resources
            because ledger entries carry no payloads.
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: >-
            The next_cursor from the previous page. Keep every other filter
            unchanged while paging.
      responses:
        '200':
          description: Credit logs returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditLogPage'
        '400':
          description: Invalid cursor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreditLogPage:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CreditLog'
        has_more:
          type: boolean
          description: Whether more entries match beyond this page.
        next_cursor:
          type:
            - string
            - 'null'
          description: Pass back as `cursor` to fetch the next page. Null on the last page.
      required:
        - data
        - has_more
    Error:
      type: object
      properties:
        detail: {}
    CreditLog:
      type: object
      properties:
        id:
          type: integer
          description: Ledger entry ID.
        credits_used:
          type: integer
          description: Credits this charge consumed.
        credits_remaining:
          type: integer
          description: >-
            Balance immediately after this charge. A snapshot, not a running
            total: renewals reset the balance without writing an entry.
        service:
          $ref: '#/components/schemas/CreditService'
        user:
          $ref: '#/components/schemas/LogUser'
        created_at:
          type: integer
          format: int64
          example: 1784874205
          description: Charge time in Unix seconds.
      required:
        - id
        - credits_used
        - credits_remaining
        - service
        - user
        - created_at
    CreditService:
      type: object
      properties:
        type:
          type: string
          enum:
            - workflow
            - agent
            - copilot
            - mcp
          description: What was charged.
        id:
          type:
            - string
            - 'null'
          description: >-
            The workflow, conversation, or MCP server charged. Matches source.id
            on operation logs.
        name:
          type:
            - string
            - 'null'
          description: Name at the time of the charge, not the parent's current name.
      required:
        - type
    LogUser:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: Markifact user ID.
        email:
          type:
            - string
            - 'null'
          description: Email of the team member who ran the operation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````