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

# Ask what would happen to a call, as an agent

> What the gateway would decide for one call of yours, with nothing sent. It is advice: the call itself is decided again when you make it.

Takes the agent's own credential (`oc_agent_...`) and nothing else. See the [Agent quickstart](/docs/agent-quickstart.md) for the commands that call it.

What the gateway would decide for one call of yours, with nothing sent. It is advice: the call itself is decided again when you make it. It reads no credential, counts against no rate limit of your rules and no usage, and cannot see the call's body.

> [!NOTE]
>
> **Availability:** OneCLI Cloud and self-hosted.


## OpenAPI

````yaml /openapi.yaml post /v2/agents/me/check
openapi: 3.1.0
info:
  title: OneCLI API
  version: '2'
  description: >
    The OneCLI API manages what the gateway enforces: vaults, the items in them,
    the agents connected to them, what agents may do with each item,
    organization rules, approvals and activity.


    **Base URL:** `https://api.onecli.sh` (OneCLI Cloud) or your own
    deployment's address (`http://localhost:10254` by default). Every path
    starts with `/v2`.


    ## Authentication


    Send `Authorization: Bearer <credential>`. Which credential an endpoint
    takes is on its page.


    - **Managing key** (`oc_key_...`): acts as the person who made it, in the
    organization it was made in.

    - **Agent credential** (`oc_agent_...`): reads what that agent can use and
    nothing else. On an endpoint for a person it answers `403` with the detail
    `person_required`.

    - **Connect token** (`oc_connect_...`): connects one agent to its own vault
    and does nothing else.

    - **Signed-in session**: the dashboard's own. A few endpoints take a session
    only and refuse every key.


    ## Editions


    Endpoints marked **Cloud** exist on OneCLI Cloud only. Every other endpoint
    exists on OneCLI Cloud and on a self-hosted deployment.
servers:
  - url: https://api.onecli.sh
    description: OneCLI Cloud
  - url: http://localhost:10254
    description: Self-hosted
security: []
tags:
  - name: Vaults
    description: A vault holds items and has agents connected to it.
  - name: Items
    description: >-
      The connected apps, API keys and LLM keys in a vault. Values are
      write-only.
  - name: Permissions
    description: What the agents on a vault may do with one item, per tool.
  - name: Connect tokens
    description: The tokens that connect a new agent to a vault.
  - name: Agents
    description: The agents connected to the vaults you can use.
  - name: Agent sign-ups
    description: How an agent with no credential asks a person to connect it.
  - name: Agent self-service
    description: What an agent reads about itself with its own credential.
  - name: Approvals
    description: The requests the gateway holds until a person answers.
  - name: Rules
    description: 'Organization rules: block, require approval, or rate-limit.'
  - name: Activity
    description: 'What agents did: the request log, usage counts and the audit log.'
  - name: Apps
    description: The apps that can be connected, and the organization's own OAuth apps.
  - name: API keys
    description: 'Managing keys: the keys a person''s scripts call this API with.'
  - name: Organization
    description: You, your organizations, and an organization's name and logo.
  - name: Utility
    description: Health check.
  - name: Members
    description: The people of an organization and their roles.
  - name: Invites
    description: Invite people to an organization by email.
  - name: Groups
    description: Groups of members, used to share vaults and to set roles.
  - name: Vault sharing
    description: The people and groups a vault is shared with.
  - name: Shared items
    description: Items an organization keeps once and shares with chosen vaults.
  - name: Sign-in
    description: 'Single sign-on: identity provider connections, domains and enforcement.'
  - name: Directory tokens
    description: Tokens the organization's directory syncs people and groups with.
  - name: LLM sign-in
    description: Add a Claude or ChatGPT subscription to a vault by signing in.
  - name: Billing
    description: The organization's plan, credits and payment state.
  - name: Support
    description: Write to the OneCLI team, or ask for an app.
paths:
  /v2/agents/me/check:
    post:
      tags:
        - Agent self-service
      summary: Ask what would happen to a call, as an agent
      description: >-
        What the gateway would decide for one call of yours, with nothing sent.
        It is advice: the call itself is decided again when you make it. It
        reads no credential, counts against no rate limit of your rules and no
        usage, and cannot see the call's body.
      operationId: postAgentsMeCheck
      parameters:
        - description: Not accepted on this call. Sending it is 400 bad_request.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            maxLength: 255
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCheckRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCheck'
          description: What would happen.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not signed in.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not allowed.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Validation failed.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Too many checks. Wait for Retry-After seconds.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Unexpected error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCheckUnknown'
          description: The gateway could not decide. Never read this as allowed.
      security:
        - agentBearer: []
components:
  schemas:
    AgentCheckRequest:
      properties:
        method:
          description: The HTTP method of the call you plan.
          pattern: ^[A-Za-z]{1,16}$
          type: string
        url:
          description: The full address of the call you plan.
          maxLength: 8192
          pattern: ^https?:\/\/[^\s/?#]+/i
          type: string
      required:
        - method
        - url
      type: object
    AgentCheck:
      properties:
        code:
          description: >-
            Set when a usage limit refuses the call: the error code the call
            itself would be answered with. null: no usage limit refuses it.
          type:
            - string
            - 'null'
        decision:
          description: >-
            allowed: it would be sent with your item. blocked: a rule or a usage
            limit refuses it. needs_approval: a person must approve it first.
            no_item: nothing of yours serves it, so it would be sent with no
            credential. destination_refused: the gateway does not send there.
          enum:
            - allowed
            - blocked
            - needs_approval
            - no_item
            - destination_refused
          type: string
        item:
          description: >-
            The item the call would use, by its id in your list of items. null:
            none.
          properties:
            id:
              type: string
          required:
            - id
          type:
            - object
            - 'null'
        reason:
          description: The decision in words, with what it could not take into account.
          type: string
        rule:
          description: >-
            The rule that decided. null: no rule did, or the rule is set above
            your vault and does not block.
          properties:
            id:
              description: null for a rule set above your vault.
              type:
                - string
                - 'null'
            name:
              type: string
          required:
            - id
            - name
          type:
            - object
            - 'null'
      required:
        - decision
        - item
        - rule
        - reason
        - code
      type: object
    Error:
      properties:
        error:
          properties:
            code:
              enum:
                - bad_request
                - validation_failed
                - unauthenticated
                - forbidden
                - not_found
                - conflict
                - gone
                - idempotency_conflict
                - precondition_required
                - rate_limited
                - authorization_pending
                - slow_down
                - access_denied
                - expired_token
                - internal
                - unavailable
              type: string
            details:
              items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            message:
              type: string
            requestId:
              description: The X-Request-Id of this call, to quote when asking.
              type:
                - string
                - 'null'
          required:
            - code
            - message
            - details
            - requestId
          type: object
      required:
        - error
      type: object
    AgentCheckUnknown:
      properties:
        decision:
          enum:
            - unknown
          type: string
        reason:
          type: string
      required:
        - decision
        - reason
      type: object
    ErrorDetail:
      properties:
        field:
          description: Where the problem is.
          type: string
        issue:
          description: What kind of problem.
          type: string
        message:
          description: The problem in words.
          type: string
      required:
        - field
        - issue
        - message
      type: object
  securitySchemes:
    agentBearer:
      description: >-
        An agent's own credential (oc_agent_...). It reads what that agent can
        use and nothing else.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.