# v0/usage/rpc/by-endpoint

Retrieves usage data by endpoint.

## Parameters

- **start_time** (integer (optional)): Specifies the start of the time period for which the usage data is to be retrieved. For periods longer than a week, times are rounded down to midnight UTC for performance optimization.

- **end_time** (integer (optional)): Specifies the end of the time period for which the usage data is to be retrieved. For periods longer than a week, times are rounded down to midnight UTC for performance optimization.

## Returns

- **data** (object): The data object which contains the following fields:
  - **endpoints** (array): An array of endpoints which contains the following fields:
    - **name** (string): The name of the endpoint
    - **label** (string): A custom label for the endpoint
    - **chain** (string): The blockchain associated with the endpoint
    - **status** (string): The current state of the RPC endpoint. Possible values include: active, archived, paused or terminated
    - **network** (string): The specific network on the blockchain
    - **credits_used** (integer): The total number of credits used by the endpoint
    - **requests** (integer): The total number of requests made to the endpoint
    - **methods_breakdown** (array): An array of methods_breakdown
      - **method_name** (string): The name of the method called
      - **credits_used** (integer): The number of credits used by the method
      - **archive** (boolean): Indicates whether the request is using archived data
  - **start_time** (integer): The start timestamp for the data in second in second
  - **end_time** (integer): The end timestamp for the data in second in second

- **error** (string): A field containing an error message if any issue occurs

## Code Examples

### _CATEGORY_

```json
{
	"position": 2
}
```

### CURL

```sh
curl -X 'GET' \
  'https://api.quicknode.com/v0/usage/rpc/by-endpoint' \
  -H 'accept: application/json' \
  -H 'x-api-key: YOUR_API_KEY'
```

### JAVASCRIPT

```js
const myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://api.quicknode.com/v0/usage/rpc/by-endpoint", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

### PYTHON

```py
import requests

url = "https://api.quicknode.com/v0/usage/rpc/by-endpoint"

payload = {}
headers = {
  'accept': 'application/json',
  'x-api-key': 'YOUR_API_KEY',
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

### RUBY

```rb
require "uri"
require "net/http"

url = URI("https://api.quicknode.com/v0/usage/rpc/by-endpoint")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["x-api-key"] = "YOUR_API_KEY"

response = https.request(request)
puts response.read_body
```

