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

# Check path is file

Check whether the path identifies a file.

```json 200
{
  "is_file": true
}
```

```json Explain
{
  "explanation": {
    "call": "is_file",
    "paths": [
      "/hello.txt"
    ],
    "outcome": "allow",
    "reason": "",
    "source": "",
    "decision": null,
    "answers": [],
    "error": ""
  }
}
```

> [accordion] Errors
>
> | Status | Meaning |
> | - | - |
> | `400` | The request is malformed: the body is not JSON (`invalid_json`) or not a JSON object, a field is missing (`missing_field`), unknown (`unknown_field`) or has a wrong value (`invalid_value`), or the request is otherwise invalid (`invalid_request`). `param` names the field at fault. |
> | `401` | The token is missing or wrong (`unauthorized`). |
> | `403` | The call is refused. A policy refused it (`policy_refused`, with `decision`), a mount mode or permission refused it (`forbidden`), the backend is out of space or quota (`storage_full`), or the request came for a host or from a browser origin that is not allowed (`host_not_allowed`, `origin_not_allowed`). |
> | `404` | The workspace, session, job, file or route does not exist, or the caller may not see it (`not_found`). |
> | `409` | The request conflicts with the current state. The id or name is taken (`already_exists`), the workspace is busy on another server or starting or stopping (`workspace_busy`), the workspace is stopped (`workspace_stopped`), a file changed since it was read (`stale_write`), or the state allows no such change (`conflict`). |
> | `429` | Past a rate limit (`rate_limited`), or a new session past max\_sessions (`session_limit`). |
> | `413` | The request body, a multipart part, or stdin exceeds its size limit (`too_large`). |
> | `500` | The server failed internally (`internal`). The message is `internal server error` and the cause goes to the server log. A file call that fails with an I/O error (`EIO`, `EPIPE`, `EBADF`) carries its `errno` and the POSIX message instead. Check for side effects before retrying. |
>
> See [error examples and recovery steps](https://docs.mirage.strukto.ai/api/errors.md). The [complete OpenAPI contract](https://github.com/strukto-ai/mirage/blob/main/docs/openapi.yaml) includes every response schema.


## OpenAPI

````yaml /openapi.yaml post /v1/workspaces/{workspace_id}/vfs/is_file
openapi: 3.2.0
info:
  title: Mirage API
  version: '0.1'
servers:
  - url: http://127.0.0.1:8765
    description: A local server on its default port
security:
  - bearerAuth: []
tags:
  - name: Workspace operations
    x-group: Workspaces
  - name: Workspaces
    x-group: Lifecycle
    parent: Workspace operations
  - name: Sessions
  - name: Shell
    parent: Workspace operations
  - name: VFS
    parent: Workspace operations
  - name: Tools
  - name: Documents
    x-group: Agent Instructions
    parent: Workspace operations
  - name: Snapshots
  - name: Templates
    parent: Configuration
  - name: Saved VFS
    x-group: VFS
    parent: Configuration
  - name: Saved CLIs
    x-group: CLI
    parent: Configuration
  - name: Saved machines
    x-group: Machine
    parent: Configuration
  - name: Configuration
  - name: Policies
    parent: Configuration
  - name: Asks
    parent: Workspace operations
    x-group: Approval requests
  - name: Lines
    parent: Workspace operations
    x-group: Commands
  - name: Jobs
    parent: Workspace operations
  - name: Processes
    parent: Workspace operations
  - name: Machines
    parent: Workspace operations
  - name: Server
  - name: Service
    parent: Server
  - name: Daemon
    parent: Server
  - name: Auth
paths:
  /v1/workspaces/{workspace_id}/vfs/is_file:
    post:
      tags:
        - VFS
      summary: Check path is file
      operationId: endpoint_v1_workspaces__workspace_id__vfs_is_file_post
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - $ref: '#/components/parameters/sessionId'
        - $ref: '#/components/parameters/explain'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                path:
                  type: string
              required:
                - path
              additionalProperties: false
            example:
              path: /hello.txt
      responses:
        '200':
          description: >-
            `is_file` is what the call returns. With `explain=true`,
            `explanation` says what the call would do; nothing runs.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    title: Result
                    properties:
                      is_file:
                        type: boolean
                    required:
                      - is_file
                    additionalProperties: false
                  - $ref: '#/components/schemas/VfsExplained'
              examples:
                result:
                  summary: '200'
                  value:
                    is_file: true
                explain:
                  summary: Explain
                  value:
                    explanation:
                      call: is_file
                      paths:
                        - /hello.txt
                      outcome: allow
                      reason: ''
                      source: ''
                      decision: null
                      answers: []
                      error: ''
components:
  parameters:
    workspaceId:
      name: workspace_id
      in: path
      required: true
      description: Workspace ID.
      schema:
        type: string
      example: demo
    sessionId:
      name: session_id
      in: query
      required: false
      description: Session ID to use. If omitted, the default session is used.
      schema:
        type: string
      example: analysis
    explain:
      name: explain
      in: query
      description: Return what the call would do without running it.
      required: false
      schema:
        type: boolean
        default: false
  schemas:
    VfsExplained:
      type: object
      title: Explanation (explain=true)
      description: A VFS call's answer with `explain=true`.
      properties:
        explanation:
          $ref: '#/components/schemas/VfsExplanation'
      required:
        - explanation
      additionalProperties: false
    VfsExplanation:
      allOf:
        - $ref: '#/components/schemas/Explanation'
        - type: object
          properties:
            call:
              type: string
              description: The VFS call explained, such as `write`.
            paths:
              type: array
              items:
                type: string
              description: The call's path arguments, as given. `rename` has two.
            error:
              type: string
              description: >-
                The errno name the call would raise, such as `EACCES`. Empty
                when it runs.
          required:
            - call
            - paths
            - error
      title: Explanation (explain=true)
    Explanation:
      type: object
      description: >-
        Policy evaluation for a request without executing it. Returned when
        `explain=true`.
      properties:
        outcome:
          type: string
          enum:
            - allow
            - deny
            - ask
          description: >-
            `ask` stays `ask` when an approval already covers the request; then
            `decision` is `null`.
        reason:
          type: string
          description: >-
            Reason returned by the policy that determined the outcome. Empty
            when nothing refuses or asks.
        source:
          type: string
          description: >-
            Where in the profile the deciding tree is written, `top` or a mount
            section such as `mounts./runbook`. Empty when no tree decided.
        answers:
          type: array
          items:
            $ref: '#/components/schemas/PolicyAnswer'
          description: Every policy's answer, in the order the policies are asked.
        decision:
          anyOf:
            - $ref: '#/components/schemas/PolicyDecision'
            - type: 'null'
          description: The record a refused request carries. `null` when it would run.
      required:
        - outcome
        - reason
        - source
        - answers
        - decision
    PolicyAnswer:
      type: object
      description: One policy's answer to a request.
      properties:
        kind:
          type: string
          enum:
            - deny
            - ask
            - route
        reason:
          type: string
          description: Reason the policy gave.
        policy:
          type: string
          description: >-
            Name of the policy. Rules written in the profile answer as
            `PermissionsPolicy`.
        machine:
          anyOf:
            - type: string
            - type: 'null'
          description: Machine the request is routed to. Only for `route`.
      required:
        - kind
        - reason
        - policy
    PolicyDecision:
      type: object
      description: >-
        Why a policy refused a command or part of it. A refusal can come after
        the command ran and does not undo what it did.
      properties:
        kind:
          type: string
          enum:
            - deny
            - pending
            - failed
          description: >-
            `deny` when a policy refused it, `pending` when it waits for an
            approval, `failed` when a policy raised an error and so refused by
            default.
        reason:
          type: string
          description: Reason given by the policy or the approval request.
        policy:
          type: string
          description: Name of the policy that refused. Empty for `pending`.
        ask_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Approval request ID, for `pending`.
        matched:
          anyOf:
            - $ref: '#/components/schemas/PolicyMatch'
            - type: 'null'
          description: >-
            What fired in the profile rule that refused, for `deny`. Null for
            any other refusal.
      required:
        - kind
        - reason
        - policy
        - ask_id
        - matched
    PolicyMatch:
      type: object
      description: >-
        The command path, options and operand or value keys of the tree entry
        that refused the line, or the line's own command path when the root
        `"*"` refused it.
      properties:
        command:
          type: array
          items:
            type: string
          description: Command name and its subcommands, by their canonical names.
        flags:
          type: array
          items:
            type: string
          description: >-
            Options the pattern names, by their canonical spelling. Empty when
            it names none.
        keys:
          type: array
          items:
            type: string
          description: >-
            The operand and value keys the tree names on the way to the entry
            that fired, as written, such as `secret*` for `echo secret1` under
            `{echo: {operands: {"secret*": deny}}}`. Empty when it names none.
      required:
        - command
        - flags
        - keys
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        The server's token (MIRAGE_AUTH_TOKEN) or a JWT. A daemon in the default
        local mode with no token accepts requests without one.

````

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