APIPASS API Marketplace Provider Token API

The Provider Token API from APIPASS API Marketplace — 5 operation(s) for provider token.

Operations 5

GET /api/v1/provider-token/keys/need-refresh Get Keys Need Refresh #
PATCH /api/v1/provider-token/keys/{key_id}/token Update Token #
POST /api/v1/provider-token/keys/{key_id}/mark-refresh Mark Key Need Refresh #
POST /api/v1/provider-token/keys/{key_id}/clear-refresh-mark Clear Key Refresh Mark #
POST /api/v1/provider-token/keys/{key_id}/reset-failures Reset Key Failures #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/apipass:apipass-provider-token-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

apipass-provider-token-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ApiPass Platform Provider Token API
  version: 1.0.0
tags:
- name: Provider Token
paths:
  /api/v1/provider-token/keys/need-refresh:
    get:
      tags:
      - Provider Token
      summary: Get Keys Need Refresh
      description: '获取需要刷新的 provider_api_keys


        刷新条件(任一满足即返回):

        1. token_expires_at 即将过期或为空(如果 include_expiring=true)

        2. is_active = false(如果 include_inactive=true)

        3. metadata.needs_refresh = true(如果 include_needs_refresh=true)


        排除条件:

        - metadata.consecutive_failures >= max_consecutive_failures 的 keys(需要人工干预)

        - 没有 metadata.dicloak_env_id 的 keys'
      operationId: get_keys_need_refresh_api_v1_provider_token_keys_need_refresh_get
      parameters:
      - name: provider_name
        in: query
        required: false
        schema:
          type: string
          description: Provider 名称
          default: google-flow
          title: Provider Name
        description: Provider 名称
      - name: refresh_before_minutes
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          description: token 过期前多少分钟刷新
          default: 10
          title: Refresh Before Minutes
        description: token 过期前多少分钟刷新
      - name: max_consecutive_failures
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          description: 连续失败超过此次数后跳过
          default: 100
          title: Max Consecutive Failures
        description: 连续失败超过此次数后跳过
      - name: include_inactive
        in: query
        required: false
        schema:
          type: boolean
          description: 是否包含 is_active=false 的 keys
          default: true
          title: Include Inactive
        description: 是否包含 is_active=false 的 keys
      - name: include_needs_refresh
        in: query
        required: false
        schema:
          type: boolean
          description: 是否包含 needs_refresh=true 的 keys
          default: true
          title: Include Needs Refresh
        description: 是否包含 needs_refresh=true 的 keys
      - name: include_expiring
        in: query
        required: false
        schema:
          type: boolean
          description: 是否包含即将过期的 keys
          default: true
          title: Include Expiring
        description: 是否包含即将过期的 keys
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          description: 返回数量限制
          default: 50
          title: Limit
        description: 返回数量限制
      - name: x-admin-token
        in: header
        required: true
        schema:
          type: string
          description: Admin Token
          title: X-Admin-Token
        description: Admin Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeysNeedRefreshResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/provider-token/keys/{key_id}/token:
    patch:
      tags:
      - Provider Token
      summary: Update Token
      description: '更新 provider_api_key 的 token


        刷新成功时:

        - 更新 api_key 为新的 session token

        - 增量更新 metadata(last_refresh_at, refresh_count, token_expires_at 等)

        - 可选更新 is_active(传入时才更新)


        刷新失败时:

        - 不更新 api_key

        - 记录 metadata.last_refresh_error 和 consecutive_failures


        注意: last_checked_at 由 credits 检查任务更新,本接口不修改'
      operationId: update_token_api_v1_provider_token_keys__key_id__token_patch
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          title: Key Id
      - name: x-admin-token
        in: header
        required: true
        schema:
          type: string
          description: Admin Token
          title: X-Admin-Token
        description: Admin Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTokenRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateTokenResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/provider-token/keys/{key_id}/mark-refresh:
    post:
      tags:
      - Provider Token
      summary: Mark Key Need Refresh
      description: '手动标记某个 key 需要刷新


        设置 metadata.needs_refresh = true'
      operationId: mark_key_need_refresh_api_v1_provider_token_keys__key_id__mark_refresh_post
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          title: Key Id
      - name: x-admin-token
        in: header
        required: true
        schema:
          type: string
          description: Admin Token
          title: X-Admin-Token
        description: Admin Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/provider-token/keys/{key_id}/clear-refresh-mark:
    post:
      tags:
      - Provider Token
      summary: Clear Key Refresh Mark
      description: '清除某个 key 的刷新标记


        设置 metadata.needs_refresh = false'
      operationId: clear_key_refresh_mark_api_v1_provider_token_keys__key_id__clear_refresh_mark_post
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          title: Key Id
      - name: x-admin-token
        in: header
        required: true
        schema:
          type: string
          description: Admin Token
          title: X-Admin-Token
        description: Admin Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/provider-token/keys/{key_id}/reset-failures:
    post:
      tags:
      - Provider Token
      summary: Reset Key Failures
      description: '重置某个 key 的连续失败计数


        用于手动干预后重新尝试刷新

        设置 metadata.consecutive_failures = 0'
      operationId: reset_key_failures_api_v1_provider_token_keys__key_id__reset_failures_post
      parameters:
      - name: key_id
        in: path
        required: true
        schema:
          type: string
          title: Key Id
      - name: x-admin-token
        in: header
        required: true
        schema:
          type: string
          description: Admin Token
          title: X-Admin-Token
        description: Admin Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateTokenResponse:
      properties:
        code:
          type: integer
          title: Code
          default: 200
        message:
          type: string
          title: Message
          default: success
        data:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Data
      type: object
      title: UpdateTokenResponse
      description: 更新 token 响应
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UpdateTokenRequest:
      properties:
        api_key:
          type: string
          title: Api Key
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
        clear_needs_refresh:
          type: boolean
          title: Clear Needs Refresh
          default: true
        error_message:
          anyOf:
          - type: string
          - type: 'null'
          title: Error Message
        token_expires_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Token Expires At
      type: object
      required:
      - api_key
      title: UpdateTokenRequest
      description: 更新 token 请求
    ProviderKeyRefreshItem:
      properties:
        id:
          type: string
          title: Id
        provider_id:
          type: string
          title: Provider Id
        api_key:
          type: string
          title: Api Key
        is_active:
          type: boolean
          title: Is Active
        last_checked_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Last Checked At
        token_expires_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Token Expires At
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
        note:
          anyOf:
          - type: string
          - type: 'null'
          title: Note
      type: object
      required:
      - id
      - provider_id
      - api_key
      - is_active
      title: ProviderKeyRefreshItem
      description: 需要刷新的 key 信息
    KeysNeedRefreshResponse:
      properties:
        code:
          type: integer
          title: Code
          default: 200
        message:
          type: string
          title: Message
          default: success
        data:
          items:
            $ref: '#/components/schemas/ProviderKeyRefreshItem'
          type: array
          title: Data
        total:
          type: integer
          title: Total
      type: object
      required:
      - data
      - total
      title: KeysNeedRefreshResponse
      description: 需要刷新的 keys 列表响应
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer