> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sorsa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 用户名转用户 ID

> 将 Twitter/X 用户名转换为对应的稳定数字用户 ID。与用户名不同，用户 ID 永不变化，因此适合长期存储和交叉引用。



## OpenAPI

````yaml openapi-zh-Hans.json GET /username-to-id/{user_handle}
openapi: 3.0.3
info:
  contact: {}
  title: Sorsa.io API
  version: '3.0'
servers:
  - url: https://api.sorsa.io/v3
security: []
paths:
  /username-to-id/{user_handle}:
    get:
      tags:
        - 实用工具
      summary: 用户名转用户 ID
      description: 将 Twitter/X 用户名转换为对应的稳定数字用户 ID。与用户名不同，用户 ID 永不变化，因此适合长期存储和交叉引用。
      parameters:
        - description: user_handle 必填
          in: path
          name: user_handle
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/technical.IDRes'
          description: 成功
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 请求无效
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 未授权
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 禁止访问
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 未找到
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 请求过多
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handler.ErrorResponse'
          description: 服务器内部错误
      security:
        - ApiKeyAuth: []
components:
  schemas:
    technical.IDRes:
      properties:
        id:
          description: Twitter/X 数字用户 ID。
          example: '1'
          type: string
      type: object
    handler.ErrorResponse:
      properties:
        message:
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: ApiKey
      type: apiKey

````