# GET /v1/account

获取 API 密钥的套餐、限额和端点权限

返回 API 密钥的套餐、请求限额、每个实时限额及其剩余次数，以及每个 `/v1` 端点和该密钥能否调用。

所有套餐可用。计入每秒 10 次请求的限额，不计入实时限额。

## 请求

`GET https://api.cs2.sh/v1/account`

**curl**

```bash
curl https://api.cs2.sh/v1/account \
  -H "Authorization: Bearer <<YOUR_API_KEY>>" \
  -H "Accept-Encoding: gzip" --compressed
```

**Python**

```python
import requests

headers = {
    "Authorization": "Bearer <<YOUR_API_KEY>>",
    "Accept-Encoding": "gzip",
}

response = requests.get(
    "https://api.cs2.sh/v1/account",
    headers=headers,
)

response.raise_for_status()
data = response.json()
```

**Node**

```javascript
const headers = {
  "Authorization": "Bearer <<YOUR_API_KEY>>",
  "Accept-Encoding": "gzip",
};

const response = await fetch("https://api.cs2.sh/v1/account", { headers });

if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
```

**Go**

```go
package main

import (
    "compress/gzip"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://api.cs2.sh/v1/account", nil)
    req.Header.Set("Authorization", "Bearer <<YOUR_API_KEY>>")
    req.Header.Set("Accept-Encoding", "gzip")

    resp, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer resp.Body.Close()

    if resp.StatusCode < 200 || resp.StatusCode >= 300 {
        body, _ := io.ReadAll(resp.Body)
        panic(fmt.Sprintf("HTTP %d: %s", resp.StatusCode, body))
    }

    var reader io.Reader = resp.Body
    if resp.Header.Get("Content-Encoding") == "gzip" {
        gz, err := gzip.NewReader(resp.Body)
        if err != nil { panic(err) }
        defer gz.Close()
        reader = gz
    }

    var data any
    if err := json.NewDecoder(reader).Decode(&data); err != nil { panic(err) }
    fmt.Printf("%#v\n", data)
}
```

**R**

```r
library(httr2)

resp <- request("https://api.cs2.sh/v1/account") |>
  req_headers(
    Authorization = "Bearer <<YOUR_API_KEY>>",
    `Accept-Encoding` = "gzip"
  ) |>
  req_perform()

data <- resp_body_json(resp)
```

## 响应

```json
{
  "plan": "developer",
  "key": {
    "type": "paid",
    "expires_at": null
  },
  "limits": {
    "requests_per_second": 10,
    "live_requests_per_minute": {
      "youpin/listings": 6,
      "csfloat/listings": 6,
      "steam/listings": 40
    }
  },
  "live": {
    "youpin/listings": {
      "remaining": 6,
      "resets_at": "2026-11-30T05:43:35Z"
    },
    "csfloat/listings": {
      "remaining": 5,
      "resets_at": "2026-11-30T05:43:45Z"
    },
    "steam/listings": {
      "remaining": 40,
      "resets_at": "2026-11-30T05:43:35Z"
    }
  },
  "endpoints": [
    {
      "method": "GET",
      "path": "/v1/account",
      "available": true
    },
    {
      "method": "POST",
      "path": "/v1/prices/latest",
      "available": true
    },
    {
      "method": "POST",
      "path": "/v1/live/csfloat/listings",
      "available": true
    },
    {
      "method": "POST",
      "path": "/v1/sales/csfloat",
      "available": false,
      "plan": "scale"
    }
  ]
}
```

## 响应字段

[AccountResponse](/zh-cn/docs/objects#accountresponse) 字段:

| 字段 | 类型 | 必需 | 描述 |
| --- | --- | --- | --- |
| `plan` | `string` | 是 | 允许值: `DEMO`, `developer`, `scale`, `enterprise`. 密钥的套餐。演示密钥的套餐为 `DEMO`。 |
| `key` | `object` | 是 | 发起请求的 API 密钥。 |
| `limits` | `object` | 是 | 账户的请求限额。 |
| `live` | `Record<string, object>` | 否 | 每个实时限额当前的剩余次数，键与 `limits.live_requests_per_minute` 相同。演示密钥没有此字段。 |
| `live_demo` | `object` | 否 | 演示密钥的实时请求。仅演示密钥有此字段。 |
| `endpoints` | `object[]` | 是 | 每个 `/v1` 端点，每个实时操作各列为一个路径。 |
