LogoAIDIR Docs

API Token Info

API for getting Twitter API usage quota information

API Token Info

Get information about the current Twitter API token usage, including remaining request quota and reset time.

Request

URL: /api/twitter/token-info

Method: GET or POST

Request Parameters:

No specific parameters required, just provide the API key for authentication.

Response

A successful response will return the current API token usage information, including remaining request count, quota limit, reset time, and other details.

Examples

Request Example

# GET request
curl --request GET \
  --url 'https://www.aidir.fun/api/twitter/token-info' \
  --header 'X-API-Key: <api-key>'
 
# POST request
curl --request POST \
  --url 'https://www.aidir.fun/api/twitter/token-info' \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>'

Response Example

{
  "data": {
    "token_type": "bearer",
    "app_limit": 1500,
    "remaining": 1375,
    "reset_at": "2023-04-15T15:00:00.000Z",
    "account": {
      "app_id": "12345",
      "app_name": "My Twitter App",
      "organization": "My Organization"
    },
    "request_history": [
      {
        "endpoint": "/user-profile",
        "timestamp": "2023-04-15T14:34:12.000Z",
        "status": "success"
      },
      {
        "endpoint": "/user-tweets",
        "timestamp": "2023-04-15T14:30:05.000Z",
        "status": "success"
      }
    ]
  }
}

Error Responses

Status CodeDescription
401Authentication failed, API key invalid or missing
500Internal server error

Use Cases

Using this API, you can:

  1. Monitor API Usage: Understand your current API usage to avoid exceeding quota limits
  2. Optimize Request Strategy: Adjust request frequency based on remaining quota
  3. Debug Issues: When API requests fail, check if it's due to rate limiting

Notes

  • API quotas are typically calculated based on a sliding time window, with specific limits depending on your Twitter API subscription level
  • Exceeding quota limits may result in requests being temporarily blocked
  • This API does not consume Twitter API request quota and can be called frequently to monitor usage

Table of Contents