Skip to Content
Referência da APIEstatísticas de Uso

Estatísticas de Uso

Visualize estatísticas de uso da API para sua conta, incluindo contagem de requisições, status do rate limit e streams ativos.

GET /api/v1/account/usage

Este endpoint substitui o antigo endpoint /me/usage. O formato de resposta foi atualizado para utilizar o envelope padrão v1.

AutenticaçãoPermalink for this section

Requer API key. Disponível para todos os planos.

Exemplos de RequisiçõesPermalink for this section

curl -X GET "https://api.sharpapi.io/api/v1/account/usage" \ -H "X-API-Key: YOUR_API_KEY"

RespostaPermalink for this section

Sucesso (200)Permalink for this section

{ "data": { "requests": { "today": 342, "this_week": 2105, "this_month": 14523, "limit": { "per_minute": 300, "remaining": 287, "resets_at": "2026-02-08T14:45:00.000Z" } }, "streams": { "active": 2, "max": 10 }, "period": { "start": "2026-02-01T00:00:00.000Z", "end": "2026-02-28T23:59:59.000Z" } }, "meta": { "updated_at": "2026-02-08T14:50:00.123Z" } }

Cabeçalhos de RespostaPermalink for this section

X-RateLimit-Limit: 300 X-RateLimit-Remaining: 287 X-RateLimit-Reset: 1707401400 X-Data-Delay: 0 X-Request-Id: req_usage789abc

Respostas de ErroPermalink for this section

401 Unauthorized

{ "error": { "code": "unauthorized", "message": "Invalid or missing API key", "docs": "https://docs.sharpapi.io/en/authentication" } }

Campos de RespostaPermalink for this section

Objeto RequestsPermalink for this section

CampoTipoDescrição
todaynumberTotal de requisições à API hoje (UTC)
this_weeknumberTotal de requisições à API nesta semana
this_monthnumberTotal de requisições à API neste mês de cobrança

Objeto Requests LimitPermalink for this section

CampoTipoDescrição
per_minutenumberMáximo de requisições à API permitidas por minuto
remainingnumberRequisições restantes na janela atual do rate limit
resets_atstringTimestamp ISO 8601 de quando a janela do rate limit é reiniciada

Objeto StreamsPermalink for this section

CampoTipoDescrição
activenumberNúmero de streams SSE/WebSocket atualmente ativos
maxnumberMáximo de streams simultâneos permitidos (0 se streaming não estiver habilitado)

Objeto PeriodPermalink for this section

CampoTipoDescrição
startstringInício ISO 8601 do mês de cobrança atual
endstringFim ISO 8601 do mês de cobrança atual

Casos de UsoPermalink for this section

Monitorar Uso do Rate LimitPermalink for this section

import requests response = requests.get( 'https://api.sharpapi.io/api/v1/account/usage', headers={'X-API-Key': 'YOUR_API_KEY'} ) usage = response.json()['data'] limit = usage['requests']['limit'] usage_pct = (1 - limit['remaining'] / limit['per_minute']) * 100 print(f"Rate limit usage: {usage_pct:.1f}%") print(f"Resets at: {limit['resets_at']}")

Verificar Disponibilidade de StreamsPermalink for this section

const { data } = await fetch( 'https://api.sharpapi.io/api/v1/account/usage', { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ).then(r => r.json()); if (data.streams.active >= data.streams.max) { console.log('All stream slots in use — close a stream before opening a new one'); } else { console.log(`${data.streams.max - data.streams.active} stream slots available`); }

Endpoints RelacionadosPermalink for this section

Last updated on