# Historical Credit Usage

`GET /team/credit-usage/historical`

Returns historical credit usage on a month-by-month basis. The endpoint can also breaks usage down by API key optionally.

> Are you an AI agent that needs a Firecrawl API key? See [firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) for automated onboarding instructions.

## OpenAPI

````yaml api-reference/v2-openapi.json get /team/credit-usage/historical
openapi: 3.0.0
info:
  title: Firecrawl API
  version: v2
  description: API for interacting with Firecrawl services to perform web scraping
    and crawling tasks.
  contact:
    name: Firecrawl Support
    url: https://firecrawl.dev/support
    email: support@firecrawl.dev
servers:
  - url: https://api.firecrawl.dev/v2
security:
  - bearerAuth: []
paths:
  /team/credit-usage/historical:
    get:
      summary: Get historical credit usage for the authenticated team
      operationId: getHistoricalCreditUsage
      tags:
        - Billing
      security:
        - bearerAuth: []
      parameters:
        - name: byApiKey
          in: query
          description: Get historical credit usage by API key
          required: false
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  periods:
                    type: array
                    items:
                      type: object
                      properties:
                        startDate:
                          type: string
                          format: date-time
                          description: Start date of the billing period
                          example: 2025-01-01T00:00:00Z
                        endDate:
                          type: string
                          format: date-time
                          description: End date of the billing period
                          example: 2025-01-31T23:59:59Z
                        apiKey:
                          type: string
                          description: Name of the API key used for the billing period. null if byApiKey
                            is false (default)
                          nullable: true
                        totalCredits:
                          type: integer
                          description: Total number of credits used in the billing period
                          example: 1000
        "500":
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Internal server error while fetching historical credit usage
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
````
