Skip to main content

Account details

The GET /v1.1/account endpoint returns the account that owns the API key in the request. This page lists the fields in the response body, how the sandbox API changes them, and the X-AlsoAsked-Credits header.

Account endpoint​

Send a request to the GET /v1.1/account endpoint to get the details of your account. The API returns the account that owns the API key in the X-Api-Key header of the request.

APIURL
Live APIhttps://alsoaskedapi.com/v1.1/account
Sandbox APIhttps://sandbox.alsoaskedapi.com/v1.1/account

Account fields​

The response body of the GET /v1.1/account endpoint is a JSON object with these fields. On the sandbox API, the credit fields and the plan_type field have different values. For details, see Account fields on the sandbox API.

NameTypeDescription
idstringThe ID of the account.
namestringThe name of the account.
emailstringThe email address of the account.
plan_typestringThe plan of the account. On the live API, the value is always pro, because the live API returns 402 Payment Required to an account without a Pro plan.
creditsintegerThe total credits of the account: the value of the web_credits field plus the value of the api_credits field.
web_creditsintegerThe plan credits of the account: the credits that come with the plan.
api_creditsintegerThe pay-as-you-go credits of the account: the credits that you bought.
credits_reset_atstringThe date and time when the plan credits of the account renew next, in ISO 8601 format. When plan credits renew, AlsoAsked resets them to the full amount of your plan. On the sandbox API, the date and time when the sandbox credits reset next.
registered_atstringThe date and time of the registration of the account, in ISO 8601 format.

The web_credits and api_credits fields have their names from an earlier time, when pay-as-you-go credits paid only for searches on the AlsoAsked API. Pay-as-you-go credits now also pay for searches on the AlsoAsked website. The field names stay the same for backward compatibility: the web_credits field has your plan credits, and the api_credits field has your pay-as-you-go credits.

Account fields on the sandbox API​

The sandbox API has its own credits, which are separate from the credits of your plan. On the sandbox API, the GET /v1.1/account endpoint returns the sandbox credits in the account fields:

NameValue on the sandbox API
creditsThe sandbox credits.
web_creditsThe sandbox credits.
api_credits0
plan_typepro
credits_reset_atThe date and time when the sandbox credits reset next, 24 hours after the last reset.

Each account has 1,000 sandbox credits. For details, see Sandbox API.

Credits header​

Responses from all endpoints of the live API and the sandbox API have the X-AlsoAsked-Credits header, not only the GET /v1.1/account endpoint. The value is the number of credits that remain in the account after the request:

  • On the live API, the X-AlsoAsked-Credits header has the plan credits plus the pay-as-you-go credits.
  • On the sandbox API, the X-AlsoAsked-Credits header has the sandbox credits.

Some error responses don't have the header, for example 401 Unauthorized, 403 Forbidden, and 402 Payment Required with the error type insufficient_plan. For the full list, see Credits.

Example​

The following request gets the account details from the live API:

curl --request GET 'https://alsoaskedapi.com/v1.1/account' \
--header 'X-Api-Key: YOUR_LIVE_API_KEY'

The following JSON is an example response body from the GET /v1.1/account endpoint:

{
"id": "6G8QgoK9ar0E1pB7Rl0LN5mxljdAvBWb",
"name": "Mantis Toboggan",
"email": "mantis.toboggan@example.com",
"plan_type": "pro",
"credits": 110,
"web_credits": 100,
"api_credits": 10,
"credits_reset_at": "2023-02-01T00:00:00+00:00",
"registered_at": "2023-01-01T00:00:00+00:00"
}

Teams​

If you're a member of a team, the team owner's plan and credits apply to your API requests. The GET /v1.1/account endpoint returns a mix of the 2 accounts:

FieldsWhose values
id, name, email, registered_atYour own account's.
plan_type, credits, web_credits, api_credits, credits_reset_atThe team owner's.

Your searches use the team owner's credits. Your API keys, your webhook endpoints, your webhook signing key, and your sandbox credits are your own. AlsoAsked turns API access on or off for each account, so a team member can get the api_access_disabled error even if the team owner can use the API.

In the response of the GET /v1.1/search endpoint, a team member sees only their own searches. A team administrator sees the searches of the team members, but not the searches of the team owner. The team owner sees every search of the team. For details, see Manage your search history.

If your plan changes​

The live API needs a Pro plan. If your account, or the owner of your team, no longer has a Pro plan, these things happen:

  • Every endpoint of the live API returns 402 Payment Required with the error type insufficient_plan, including GET /v1.1/account and GET /v1.1/search.
  • Searches that are already running finish, and AlsoAsked still refunds the terms that fail or have no results. If your account has the Free plan by then, AlsoAsked returns the refund of plan credits to the credits of the Free plan.
  • Webhook events for the live API that AlsoAsked hasn't sent yet fail, and AlsoAsked doesn't send them again.
  • The sandbox API keeps working.
  • AlsoAsked keeps your API keys, webhook endpoints, and pay-as-you-go credits. They work again when you have a Pro plan again.

If you cancel a Pro plan, the plan stays active until the end of the period that you paid for. If a payment is overdue, the Pro plan stops until the payment succeeds.