# Get API limits

This command needs a [bearer token](/help/rest-api/reference/authentication/) and counts towards your [hourly limit](/help/rest-api/reference/rate-limits-and-errors/).

## Get API limits

**GET**`https://api.sirv.com/v2/account/limits`

Use this method to check the allowed number of API requests and the number of requests used in the past 60 minutes.

Example request

-   [Node.js](#tab-panel-0-0)
-   [Python](#tab-panel-0-1)
-   [cURL](#tab-panel-0-2)
-   [Java](#tab-panel-0-3)
-   [C#](#tab-panel-0-4)
-   [PHP](#tab-panel-0-5)
-   [Go](#tab-panel-0-6)
-   [Ruby](#tab-panel-0-7)
-   [Swift](#tab-panel-0-8)

```js
// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/limits', {
  method: 'GET',
  headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());
```

```python
import requests

res = requests.get(
    'https://api.sirv.com/v2/account/limits',
    headers={'authorization': 'Bearer BEARER_TOKEN'},
)
print(res.status_code, res.text)
```

```bash
curl --request GET \
  --url 'https://api.sirv.com/v2/account/limits' \
  --header 'authorization: Bearer BEARER_TOKEN'
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.sirv.com/v2/account/limits"))
    .header("authorization", "Bearer BEARER_TOKEN")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
```

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

using var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.sirv.com/v2/account/limits");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "BEARER_TOKEN");
var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
```

```php
<?php
$ch = curl_init('https://api.sirv.com/v2/account/limits');
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => ['authorization: Bearer BEARER_TOKEN'],
  CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
```

```go
package main

import (
  "fmt"
  "io"
  "net/http"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.sirv.com/v2/account/limits", nil)
  req.Header.Set("authorization", "Bearer BEARER_TOKEN")
  res, err := http.DefaultClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer res.Body.Close()
  out, _ := io.ReadAll(res.Body)
  fmt.Println(res.Status, string(out))
}
```

```ruby
require 'net/http'

uri = URI('https://api.sirv.com/v2/account/limits')
req = Net::HTTP::Get.new(uri)
req['authorization'] = 'Bearer BEARER_TOKEN'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.body
```

```swift
import Foundation

var request = URLRequest(url: URL(string: "https://api.sirv.com/v2/account/limits")!)
request.httpMethod = "GET"
request.setValue("Bearer BEARER_TOKEN", forHTTPHeaderField: "authorization")
let (data, response) = try await URLSession.shared.data(for: request)
print((response as! HTTPURLResponse).statusCode, String(decoding: data, as: UTF8.self))
```

Example response

```json
{
  "s3:global": {
    "count": 0,
    "limit": 7000,
    "remaining": 7000,
    "reset": 1771859252
  },
  "s3:PUT": {
    "count": 0,
    "limit": 2000,
    "remaining": 2000,
    "reset": 1771859252
  },
  "s3:GET": {
    "count": 0,
    "limit": 3000,
    "remaining": 3000,
    "reset": 1771859252
  },
  "s3:DELETE": {
    "count": 0,
    "limit": 3000,
    "remaining": 3000,
    "reset": 1771859252
  },
  "rest:global": {
    "count": 64,
    "limit": 7000,
    "remaining": 6936,
    "reset": 1771858410
  },
  "rest:post:files:search": {
    "count": 1,
    "limit": 1000,
    "remaining": 999,
    "reset": 1771858422
  },
  "rest:post:files:search:scroll": {
    "count": 0,
    "limit": 2000,
    "remaining": 2000,
    "reset": 1771859252
  },
  "rest:post:files:video2spin": {
    "count": 1,
    "limit": 200,
    "remaining": 199,
    "reset": 1771858423
  },
  "rest:post:files:spin2video": {
    "count": 1,
    "limit": 200,
    "remaining": 199,
    "reset": 1771858426
  },
  "rest:post:files:upload": {
    "count": 0,
    "limit": 2000,
    "remaining": 2000,
    "reset": 1771859252
  },
  "rest:post:files:delete": {
    "count": 1,
    "limit": 3000,
    "remaining": 2999,
    "reset": 1771858504
  },
  "rest:post:files:batch:delete": {
    "count": 1,
    "limit": 25,
    "remaining": 24,
    "reset": 1771858518
  },
  "rest:post:account": {
    "count": 2,
    "limit": 50,
    "remaining": 48,
    "reset": 1771858410
  },
  "rest:post:account:fetching": {
    "count": 0,
    "limit": 50,
    "remaining": 50,
    "reset": 1771859252
  },
  "rest:get:stats:http": {
    "count": 1,
    "limit": 100,
    "remaining": 99,
    "reset": 1771858419
  },
  "rest:get:stats:storage": {
    "count": 1,
    "limit": 100,
    "remaining": 99,
    "reset": 1771858420
  },
  "rest:post:account:new": {
    "count": 0,
    "limit": 5,
    "remaining": 5,
    "reset": 1771859252
  },
  "rest:post:user:accounts": {
    "count": 0,
    "limit": 20,
    "remaining": 20,
    "reset": 1771859252
  },
  "rest:get:rest:credentials": {
    "count": 0,
    "limit": 50,
    "remaining": 50,
    "reset": 1771859252
  },
  "rest:post:video:toSpin": {
    "count": 0,
    "limit": 400,
    "remaining": 400,
    "reset": 1771859252
  },
  "rest:post:upload:toSirv": {
    "count": 0,
    "limit": 2000,
    "remaining": 2000,
    "reset": 1595076350
  },
  "ftp:global": {
    "count": 0,
    "limit": 10000,
    "remaining": 10000,
    "reset": 1771859252
  },
  "ftp:STOR": {
    "count": 0,
    "limit": 2000,
    "remaining": 2000,
    "reset": 1771859252
  },
  "ftp:RETR": {
    "count": 0,
    "limit": 3000,
    "remaining": 3000,
    "reset": 1771859252
  },
  "ftp:DELE": {
    "count": 0,
    "limit": 3000,
    "remaining": 3000,
    "reset": 1771859252
  },
  "fetch:file": {
    "count": 2,
    "limit": 1000,
    "remaining": 998,
    "reset": 1771858429
  },
  "fetch:largefile": {
    "count": 0,
    "limit": 10,
    "remaining": 10,
    "reset": 1771859252
  },
  "fetch:largetimeout": {
    "count": 0,
    "limit": 10,
    "remaining": 10,
    "reset": 1771859252
  },
  "zips2:create": {
    "count": 276737,
    "limit": 536870912000,
    "remaining": 536870635263,
    "reset": 1771858513
  }
}
```
