# Get this key's subscription state and consumption as daily/monthly budget percentages (/docs/api-reference/v1/usage/get)

`GET https://api.viralquery.com/v1/usage`

Get this key's subscription state and consumption as daily/monthly budget percentages

Operation ID: `getUsage`

OpenAPI document: https://viralquery.com/openapi.json

## Authentication

Bearer token: `Authorization: Bearer $VIRALQUERY_API_KEY`

## Request

This operation has no request parameters or body.

## Responses

### `200` — OK

**application/json**

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "plan": {
          "type": "string",
          "enum": [
            "viralquery"
          ]
        },
        "billingInterval": {
          "type": "string",
          "nullable": true,
          "enum": [
            "monthly",
            "annual"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active"
          ]
        },
        "active": {
          "type": "boolean",
          "enum": [
            true
          ]
        },
        "usage": {
          "type": "object",
          "properties": {
            "daily": {
              "type": "object",
              "properties": {
                "usedPct": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                }
              },
              "required": [
                "usedPct"
              ]
            },
            "monthly": {
              "type": "object",
              "properties": {
                "usedPct": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                }
              },
              "required": [
                "usedPct"
              ]
            }
          },
          "required": [
            "daily",
            "monthly"
          ]
        }
      },
      "required": [
        "plan",
        "billingInterval",
        "status",
        "active",
        "usage"
      ]
    },
    {
      "type": "object",
      "properties": {
        "plan": {
          "type": "string",
          "enum": [
            "viralquery"
          ]
        },
        "billingInterval": {
          "type": "string",
          "nullable": true,
          "enum": [
            "monthly",
            "annual"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "none",
            "cancelled",
            "past_due"
          ]
        },
        "active": {
          "type": "boolean",
          "enum": [
            false
          ]
        },
        "usage": {
          "type": "object",
          "properties": {
            "daily": {
              "type": "object",
              "properties": {
                "usedPct": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                }
              },
              "required": [
                "usedPct"
              ]
            },
            "monthly": {
              "type": "object",
              "properties": {
                "usedPct": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                }
              },
              "required": [
                "usedPct"
              ]
            }
          },
          "required": [
            "daily",
            "monthly"
          ]
        }
      },
      "required": [
        "plan",
        "billingInterval",
        "status",
        "active",
        "usage"
      ]
    }
  ]
}
```

### `400` — Invalid request (input failed validation)

**application/json**

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "invalid_request"
      ],
      "description": "Stable machine-readable error code."
    },
    "message": {
      "type": "string",
      "description": "Human-readable summary."
    },
    "issues": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "message"
        ]
      },
      "description": "First-class Zod validation issues (path + message), not a stringified blob."
    }
  },
  "required": [
    "error",
    "message",
    "issues"
  ]
}
```

### `401` — Unauthorized (missing or invalid API key)

**application/json**

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "unauthorized"
          ]
        },
        "message": {
          "type": "string"
        },
        "subscribeUrl": {
          "type": "string",
          "description": "Human-clickable ViralQuery pricing and subscription URL."
        }
      },
      "required": [
        "error",
        "message",
        "subscribeUrl"
      ]
    },
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "auth_required"
          ]
        },
        "message": {
          "type": "string",
          "description": "The session-scoped key is expired or no longer resolves to its account."
        }
      },
      "required": [
        "error",
        "message"
      ]
    }
  ]
}
```

### `403` — Forbidden (scope or plan is insufficient)

**application/json**

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "forbidden"
      ]
    },
    "message": {
      "type": "string"
    },
    "requiredScope": {
      "type": "string",
      "description": "Scope or explicit session capability required by this operation."
    },
    "grantedScopes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Scopes present on the calling key."
    }
  },
  "required": [
    "error",
    "message",
    "requiredScope",
    "grantedScopes"
  ]
}
```

### `409` — Conflict or operation error

**application/json**

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "operation_error"
      ]
    },
    "message": {
      "type": "string",
      "description": "The operation failed while handling the request."
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### `429` — Too Many Requests (rate limited)

**application/json**

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "rate_limited"
      ]
    },
    "message": {
      "type": "string"
    },
    "retryAfter": {
      "type": "number",
      "description": "Seconds to wait before retrying (mirrors the Retry-After header)."
    }
  },
  "required": [
    "error",
    "message",
    "retryAfter"
  ]
}
```