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

# Make an authorized credential-injected API request

> OAuth requires proxy:use. An external VM sends its short-lived provider OIDC bearer token, X-Factorize-VM-Grant and X-Factorize-VM-Proof. Only server-selected origins are used. Integration-wide grants are bounded by upstream credential permissions. Missing requestable access returns HTTP 403 with WWW-Authenticate insufficient_scope, scope and resource_metadata. Upstream status is returned in the result, including non-2xx. Text is UTF-8; other bodies are base64. Responses above 32 KiB are retained for 30 minutes and read in chunks. Revocation prevents subsequent calls and reads, but cannot undo upstream side effects.

Accepts a scoped bearer token, vendor-verified run identity, or interactive owner session.



## OpenAPI

````yaml /openapi.yaml post /api/v1/agent/requests
openapi: 3.1.0
info:
  title: Factorize API
  version: 1.0.0
  description: >-
    Versioned Factorize REST API. See the hosted docs for examples and OAuth
    discovery.
  x-dashboard-auth: >-
    Access-token and authorized-client management and trace replay operations
    require an interactive owner session; all other operations accept a suitably
    scoped bearer token or owner session.
servers:
  - url: https://app.factorize.sh
security:
  - bearerAuth: []
paths:
  /api/v1/agent/requests:
    post:
      tags:
        - agent
      summary: Make an authorized credential-injected API request
      description: >-
        OAuth requires proxy:use. An external VM sends its short-lived provider
        OIDC bearer token, X-Factorize-VM-Grant and X-Factorize-VM-Proof. Only
        server-selected origins are used. Integration-wide grants are bounded by
        upstream credential permissions. Missing requestable access returns HTTP
        403 with WWW-Authenticate insufficient_scope, scope and
        resource_metadata. Upstream status is returned in the result, including
        non-2xx. Text is UTF-8; other bodies are base64. Responses above 32 KiB
        are retained for 30 minutes and read in chunks. Revocation prevents
        subsequent calls and reads, but cannot undo upstream side effects.


        Accepts a scoped bearer token, vendor-verified run identity, or
        interactive owner session.
      operationId: post_api_v1_agent_requests
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                integration:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                method:
                  type: string
                  enum:
                    - GET
                    - HEAD
                    - POST
                    - PUT
                    - PATCH
                    - DELETE
                    - OPTIONS
                path:
                  type: string
                  minLength: 1
                  maxLength: 8192
                headers:
                  default: {}
                  type: object
                  propertyNames:
                    type: string
                    pattern: ^[!#$%&'*+.^_\x60|~0-9A-Za-z-]+$
                  additionalProperties:
                    type: string
                    maxLength: 8192
                execution:
                  type: string
                  enum:
                    - sync
                    - async
                idempotencyKey:
                  type: string
                  minLength: 1
                  maxLength: 160
                maxResultBytes:
                  type: integer
                  minimum: 2048
                  maximum: 32768
                bodySource:
                  oneOf:
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: payload
                        handle:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      required:
                        - kind
                        - handle
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: response
                        handle:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      required:
                        - kind
                        - handle
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: artifact
                        runId:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        artifactId:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      required:
                        - kind
                        - runId
                        - artifactId
                multipart:
                  minItems: 1
                  maxItems: 16
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 160
                      text:
                        type: string
                        maxLength: 8192
                      source:
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: payload
                              handle:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            required:
                              - kind
                              - handle
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: response
                              handle:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            required:
                              - kind
                              - handle
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: artifact
                              runId:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              artifactId:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            required:
                              - kind
                              - runId
                              - artifactId
                      filename:
                        type: string
                        minLength: 1
                        maxLength: 160
                      mediaType:
                        type: string
                        minLength: 1
                        maxLength: 160
                        pattern: ^[a-zA-Z0-9!#$&^_.+-]+\/[a-zA-Z0-9!#$&^_.+-]+$
                    required:
                      - name
                    additionalProperties: false
                body:
                  type: string
                  maxLength: 44739244
                encoding:
                  default: utf8
                  type: string
                  enum:
                    - utf8
                    - base64
              required:
                - integration
                - method
                - path
              additionalProperties: false
      responses:
        '200':
          description: Upstream response or retained response handle
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  headers:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                  size:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  encoding:
                    type: string
                    enum:
                      - utf8
                      - base64
                  body:
                    type: string
                  handle:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  expiresAt:
                    type: string
                  preview:
                    type: string
                  instructions:
                    type: string
                required:
                  - status
                  - headers
                  - size
                  - encoding
                additionalProperties: false
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '415':
          $ref: '#/components/responses/Error415'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'
      security:
        - bearerAuth: []
        - vendorRunIdentity: []
          runIdentityHeader: []
        - vmWif: []
          vmGrantHeader: []
          vmProofHeader: []
components:
  responses:
    Error400:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error401:
      description: Invalid or revoked credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error403:
      description: Missing scope or required owner session
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error404:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error409:
      description: Operation conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error415:
      description: Unsupported media type; use application/json
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error429:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error500:
      description: Internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error503:
      description: Service unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: OAuth2
    vendorRunIdentity:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Fresh vendor-signed exe.dev WIF or Fly Machine OIDC token matching the
        provisioned active run. Must be combined with X-Factorize-Run-Id; a
        vendor token alone grants no access.
    runIdentityHeader:
      type: apiKey
      in: header
      name: X-Factorize-Run-Id
      description: >-
        Provisioned run UUID. Used only to locate the immutable vendor/VM
        binding; this header is not a credential. Scopes and tenant come from
        the server-side run snapshot.
    vmWif:
      type: http
      scheme: bearer
      bearerFormat: JWT
    vmGrantHeader:
      type: apiKey
      in: header
      name: X-Factorize-VM-Grant
    vmProofHeader:
      type: apiKey
      in: header
      name: X-Factorize-VM-Proof

````

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