---
title: "Proxy"
method: POST
path: "/api/v1/twitter/{path}"
---

# Proxy

`POST /api/v1/twitter/{path}`

## Request

- Base URL: `https://api.twtapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.twtapi.com/api/v1/twitter/{path}`
- Auth: none declared

网关主入口（步骤 2~7 都在这里），把请求转发到上游并把结果回给用户。

参数 path：被通配符捕获的端点路径，如 "UserTweets" 或 "UserTweets/xxx"。
参数 user：由 get_api_key_user 完成鉴权（未带/无效 key 时它已抛 401）。

返回：成功时是上游原始 body + 若干 X-TwtAPI-* 元信息头；
上游 4xx/5xx 被改写成 502（业务码在 body 里）；上游超时/不可达返回 200 + 20401。
副作用：写 Redis（限流、信用点、缓存、配额快照）、写库（风控事件；调用日志走后台任务）、
发起上游 HTTP 请求。

计费语义：进入这里的请求在预检阶段就已经扣过费，所以每个失败出口都必须退款。
先扣后转的代价是失败路径要显式补偿，好处是并发下不会出现「先转发后扣费、
余额不足时白送一次上游调用」的超发。

## Path parameters

- `path` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-20** `5295976febaf`: 1 info
  - api operation id `proxy_api_v1_twitter__path__get` removed and replaced with `proxy_api_v1_twitter__path__delete`

[Operation history](https://skmtc.dev/twtapi/apis/twtapi-backend/changes/api/v1/twitter/:path/post.md)

---

[API](https://skmtc.dev/twtapi/apis/twtapi-backend.md) · [All operations](https://skmtc.dev/twtapi/apis/twtapi-backend/llms.txt) · [OpenAPI document](https://skmtc.dev/twtapi/apis/twtapi-backend/revisions/5295976febaf?raw)
