> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 获取用户

GET https://api.elevenlabs.io/v1/user

获取用户信息

Reference: https://elevenlabs.io/docs/api-reference/user/get

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Response

### 200

成功响应

- `user_id` (string, required) — 用户的唯一标识符。
- `workspace_id` (string, required) — 此用户 API 密钥所属工作区的唯一标识符。
- `subscription` (SubscriptionResponseModel, required) — 用户订阅详情。
- `is_onboarding_completed` (boolean, required) — 用户是否已完成入门流程。
- `is_onboarding_checklist_completed` (boolean, required) — 用户的入门清单是否已完成。
- `created_at` (integer, required) — 用户创建时的 Unix 时间戳。如果用户在添加 Unix 时间戳前创建，则为 0。
- `seat_type` (enum, required) — 用户的席位类型。
  - Allowed values: `workspace_admin`, `workspace_member`, `workspace_lite_member`
- `is_new_user` (boolean, required, deprecated) — 用户是否为新用户。此字段已弃用，将在未来移除。请改用 'created_at'。
- `can_use_delayed_payment_methods` (boolean, required, deprecated) — 此字段已弃用，将在未来的主要版本中移除。请改用 subscription.trust_on_invoice_creation。
- `show_compliance_terms` (boolean, optional, default: false) — 是否在引导流程中显示合规条款（服务条款、隐私政策、生物识别同意书）。适用于从营销网站注册的用户。
- `first_name` (string, optional, nullable) — 用户名字。
- `is_api_key_hashed` (boolean, optional, default: false) — 用户的 API 密钥是否已哈希处理。
- `xi_api_key_preview` (string, optional, nullable) — 用户 API 密钥的预览。
- `referral_link_code` (string, optional, nullable) — 用户的推荐链接代码。
- `partnerstack_partner_default_link` (string, optional, nullable) — 用户的 Partnerstack 推广伙伴默认链接。

## Errors

### 422 Unprocessable Entity Error

验证错误。

- `detail` (list of ValidationError, optional)

## Types

### SubscriptionResponseModel

- `tier` (string, required) — 用户订阅的套餐层级。
- `character_count` (integer, required) — 用户已使用的字符数。
- `character_limit` (integer, required) — 当前计费周期允许的最大字符数。
- `max_character_limit_extension` (integer, required, nullable) — 已弃用：请使用 `max_credit_limit_extension`。字符限额可超出的最大字符数。由工作区管理员管理。
- `max_credit_limit_extension` (SubscriptionResponseModelMaxCreditLimitExtension, required) — 可超出积分限额的最大积分数。由工作区管理员管理。`"unlimited"` 表示无上限，`0` 表示禁用按用量计费。
- `can_extend_character_limit` (boolean, required) — 工作区是否有资格使用超额用量（按用量计费）。
- `allowed_to_extend_character_limit` (boolean, required) — 已弃用：请使用 `max_credit_limit_extension != 0`。用户是否可以扩展字符限额。
- `voice_slots_used` (integer, required) — 用户已使用的音色席位数。
- `professional_voice_slots_used` (integer, required) — 已使用的专业音色席位数。对于合并计费，此字段统计组内所有工作区；仅查看当前工作区请参阅 professional_voice_slots_used_in_workspace。
- `professional_voice_slots_used_in_workspace` (integer, required) — 当前工作区已使用的专业音色席位数。对于合并计费，professional_voice_slots_used 统计组内所有工作区，而此字段仅统计当前工作区。
- `voice_limit` (integer, required) — 用户允许拥有的最大音色槽位数。
- `voice_add_edit_counter` (integer, required) — 用户已使用的音色添加/编辑次数。
- `professional_voice_limit` (integer, required) — 用户允许拥有的最大专业音色数。
- `can_extend_voice_limit` (boolean, required) — 用户是否可扩展音色数量限制。
- `can_use_instant_voice_cloning` (boolean, required) — 用户是否可使用即时语音克隆。
- `can_use_professional_voice_cloning` (boolean, required) — 用户是否可使用专业语音克隆。
- `current_overage` (Price, required) — 当前按用量计费的超额费用。
- `status` (enum, required) — 用户订阅状态。
  - Allowed values: `trialing`, `active`, `incomplete`, `past_due`, `free`, `free_disabled`
- `next_character_count_reset_unix` (integer, optional, nullable) — 下次重置字符计数的 Unix 时间戳。
- `max_voice_add_edits` (integer, optional, nullable) — 用户允许添加或编辑音色的最大次数。
- `currency` (enum, optional, nullable) — 用户订阅的货币。
  - Allowed values: `usd`, `eur`, `inr`, `pln`, `gbp`
- `billing_period` (enum, optional, nullable) — 用户订阅的计费周期。
  - Allowed values: `monthly_period`, `3_month_period`, `6_month_period`, `annual_period`
- `character_refresh_period` (enum, optional, nullable) — 用户订阅的字符额度刷新周期。
  - Allowed values: `monthly_period`, `3_month_period`, `6_month_period`, `annual_period`

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### SubscriptionResponseModelMaxCreditLimitExtension

可超出积分限额的最大积分数。由工作区管理员管理。`"unlimited"` 表示无上限，`0` 表示禁用按用量计费。

- integer
- "unlimited"

### Price

货币/金额对。

- `amount` (string, required)
- `currency` (enum, required)
  - Allowed values: `usd`, `eur`, `inr`, `pln`, `gbp`

### ValidationErrorLocItems

- string
- integer

## Examples

**Response**

```json
{
  "user_id": "1234567890",
  "workspace_id": "0987654321",
  "subscription": {
    "tier": "trial",
    "character_count": 17231,
    "character_limit": 100000,
    "max_character_limit_extension": 10000,
    "max_credit_limit_extension": 10000,
    "can_extend_character_limit": false,
    "allowed_to_extend_character_limit": false,
    "voice_slots_used": 1,
    "professional_voice_slots_used": 0,
    "professional_voice_slots_used_in_workspace": 0,
    "voice_limit": 120,
    "voice_add_edit_counter": 212,
    "professional_voice_limit": 1,
    "can_extend_voice_limit": false,
    "can_use_instant_voice_cloning": true,
    "can_use_professional_voice_cloning": true,
    "current_overage": {
      "amount": "0",
      "currency": "usd"
    },
    "status": "free",
    "next_character_count_reset_unix": 1738356858,
    "max_voice_add_edits": 230,
    "currency": "usd",
    "billing_period": "monthly_period",
    "character_refresh_period": "monthly_period"
  },
  "is_onboarding_completed": true,
  "is_onboarding_checklist_completed": true,
  "created_at": 1753999199,
  "seat_type": "workspace_member",
  "is_new_user": false,
  "can_use_delayed_payment_methods": false,
  "show_compliance_terms": false,
  "first_name": "John",
  "is_api_key_hashed": false
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/user"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/user';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.elevenlabs.io/v1/user"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/user")

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

request = Net::HTTP::Get.new(url)

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/user")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/user');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/user");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/user")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```