> For the complete documentation index, see [llms.txt](https://docs.iproyal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iproyal.com/scraping-tools/web-scraper-api-beta/api/user.md).

# User

Returns your credit balance and account limits.

```
GET /v1/user
```

### Request

No parameters.

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://scrape.iproyal.com/v1/user \
  -H "Authorization: Bearer $WEB_SCRAPER_API_TOKEN"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$ch = curl_init('https://scrape.iproyal.com/v1/user');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('WEB_SCRAPER_API_TOKEN'),
    ],
]);

$user = json_decode(curl_exec($ch), true);

echo $user['credit_amount'] . ' ' . $user['concurrency_limit'] . PHP_EOL;
```

{% endtab %}

{% tab title="Python" %}

```python
import os

import requests

response = requests.get(
    "https://scrape.iproyal.com/v1/user",
    headers={"Authorization": f"Bearer {os.environ['WEB_SCRAPER_API_TOKEN']}"},
    timeout=30,
)
response.raise_for_status()

user = response.json()
print(user["credit_amount"], user["concurrency_limit"])
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const response = await fetch('https://scrape.iproyal.com/v1/user', {
  headers: { Authorization: `Bearer ${process.env.WEB_SCRAPER_API_TOKEN}` },
  signal: AbortSignal.timeout(30_000),
});

const user = await response.json();
console.log(user.credit_amount, user.concurrency_limit);
```

{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class UserExample {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://scrape.iproyal.com/v1/user"))
            .header("Authorization", "Bearer " + System.getenv("WEB_SCRAPER_API_TOKEN"))
            .timeout(Duration.ofSeconds(30))
            .GET()
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        JsonNode user = new ObjectMapper().readTree(response.body());

        System.out.println(user.get("credit_amount").asLong() + " " + user.get("concurrency_limit").asInt());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"time"
)

type user struct {
	CreditAmount     int64  `json:"credit_amount"`
	Status           string `json:"status"`
	ConcurrencyLimit int    `json:"concurrency_limit"`
}

func main() {
	req, _ := http.NewRequest(http.MethodGet, "https://scrape.iproyal.com/v1/user", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("WEB_SCRAPER_API_TOKEN"))

	client := &http.Client{Timeout: 30 * time.Second}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("request failed:", err)
		return
	}
	defer resp.Body.Close()

	var body user
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		fmt.Println("unexpected response:", err)
		return
	}

	fmt.Println(body.CreditAmount, body.ConcurrencyLimit)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Net.Http.Headers;
using System.Text.Json;

using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("WEB_SCRAPER_API_TOKEN"));

using var user = JsonDocument.Parse(await client.GetStringAsync("https://scrape.iproyal.com/v1/user"));
var root = user.RootElement;

Console.WriteLine($"{root.GetProperty("credit_amount").GetInt64()} {root.GetProperty("concurrency_limit").GetInt32()}");
```

{% endtab %}
{% endtabs %}

### Response

```json
{
  "credit_amount": 48250,
  "status": "active",
  "concurrency_limit": 50
}
```

| Field               | Type    | Description                                                  |
| ------------------- | ------- | ------------------------------------------------------------ |
| `credit_amount`     | integer | Credits available on your balance                            |
| `status`            | string  | Account status. A successful response always shows `active`. |
| `concurrency_limit` | integer | Scrape requests that can run at the same time                |

### Errors

| HTTP Status | `error.code`                              |
| ----------- | ----------------------------------------- |
| `401`       | `invalid_token`                           |
| `403`       | `account_suspended` or `account_disabled` |

[API](/scraping-tools/web-scraper-api-beta/api.md) explains each code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.iproyal.com/scraping-tools/web-scraper-api-beta/api/user.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
