# 读取单个扩展操作的契约

按目录操作 ID 查询参数、文档、响应结构和报价。

GET `/v1/catalog/capabilities/{id}`

- **认证** 公开，无需登录。
- **成功状态** `200`

## 请求参数

| 参数 | 类型 | 位置 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `id` | string | `path` | 是 | 目录中的操作 ID。GET 与 POST 的 ID 可以不同。 |

## 请求示例

**cURL**

```bash
curl -i -X GET 'https://social2api.com/v1/catalog/capabilities/%7Bid%7D'
```

**Python**

```python
from urllib.error import HTTPError
from urllib.request import Request, urlopen

request = Request(
    "https://social2api.com/v1/catalog/capabilities/%7Bid%7D",
    method="GET",
)
send = urlopen
try:
    with send(request) as response:
        print(response.status, response.read().decode("utf-8"))
except HTTPError as error:
    print(error.code, error.read().decode("utf-8"))
```

**JavaScript**

```javascript
const response = await fetch("/v1/catalog/capabilities/{id}", {
  method: "GET",
});
console.log(response.status, await response.text());
```

## 响应

**200 · 示例响应**

```json
{
  "schemaVersion": 1,
  "baseUrl": "https://social2api.com",
  "providers": [
    "dataxapi",
    "socialtoai"
  ],
  "id": "bilibili.backup.users.videos.list",
  "platform": "bilibili",
  "method": "GET",
  "path": "/v1/bilibili/backup/users/videos/list",
  "pricingUnit": "call",
  "unitPrice": "0.03",
  "maxPrice": "0.03",
  "chargeWhenEmpty": "0.03",
  "chargeWhenNotFound": "0",
  "page": {
    "typical": 30,
    "max": 30,
    "cursorTtlSeconds": 3600
  },
  "documentation": "/docs/api/catalog-bilibili-backup-users-videos-list/",
  "priceProvider": "DataXAPI",
  "documentationUrl": "https://social2api.com/docs/api/catalog-bilibili-backup-users-videos-list/",
  "detailsUrl": "https://social2api.com/v1/catalog/capabilities/bilibili.backup.users.videos.list",
  "currency": "USD",
  "chargeAccount": "caller_dataxapi_account",
  "priceBook": {
    "version": "22",
    "effectiveAt": "2026-11-25T13:46:46.822Z",
    "sourceUrl": "https://dataxapi.com/prices.json",
    "sourceRevision": "0051cce45e9530b9",
    "openApiSourceUrl": "https://dataxapi.com/openapi.json"
  },
  "authentication": {
    "social2apiKeyScope": "catalog",
    "providerKeyHeader": "X-DataXAPI-Key",
    "optionalProviderKeyHeaders": {
      "socialtoai": "X-SocialToAI-Key"
    }
  },
  "inputs": {
    "query": [
      {
        "name": "id",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "8047632"
      },
      {
        "name": "cursor",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "view",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "compact",
            "standard",
            "full"
          ],
          "default": "standard"
        }
      },
      {
        "name": "fields",
        "required": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "explode": false
      }
    ]
  },
  "response": {
    "shape": "items",
    "contract": "https://social2api.com/openapi.json#/paths/~1v1~1bilibili~1backup~1users~1videos~1list/get"
  }
}
```

**错误示例**

```json
{
  "error": "找不到这个目录操作。",
  "code": "unknown_endpoint",
  "requestCount": 0
}
```

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 操作 ID。 |
| `revision` | string | 与目录列表相同的内容版本。 |
| `method` | GET \| POST | 取数请求的方法。 |
| `path` | string | 取数请求的路径。 |
| `providers` | string\[\] | 已适配的供应商，按查询优先级排列。 |
| `inputs.query` | object\[\] | 查询参数及其约束。 |
| `authentication.providerKeyHeader` | string | 调用时必需的 DataXAPI Key 请求头。 |
| `authentication.optionalProviderKeyHeaders` | object | 此操作支持的其他供应商及其可选请求头。 |
| `inputs.jsonBody` | object | 适用时提供 JSON 请求体的结构和示例。 |
| `response.contract` | URI | OpenAPI 内这一操作的契约位置。 |
| `unitPrice` | string | 上游报价，十进制美元字符串。 |
| `maxPrice` | string | 单次上游价格上限，十进制美元字符串。 |

## 错误状态

| HTTP | 原因与处理 |
| --- | --- |
| `404` | 目录中找不到该操作。 |
| `405` | 契约使用 GET。 |

## 使用细节

-   查阅契约不会发起取数调用。

## 同组接口

-   [GET 读取扩展数据接口目录](<https://social2api.com/docs/api/catalog-index/>)

规范页面：<https://social2api.com/docs/api/catalog-capability/>
