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

# replace an artifact file

> Replace the current file without changing the artifact id or human URL. The replacement must use the same format; the prior exact file becomes an immutable version available for pinned retrieval and rollback.



## OpenAPI

````yaml /openapi.json post /v1/artifacts/{id}/file
openapi: 3.1.0
info:
  title: fetchbean API
  version: v1
  description: >-
    One key for external tools and durable agent work products, with HTTP,
    hosted MCP, exact file artifacts, and spend controls.
servers:
  - url: https://api.fetchbean.com
security:
  - apiKeyAuth: []
paths:
  /v1/artifacts/{id}/file:
    post:
      tags:
        - Artifacts
      summary: replace an artifact file
      description: >-
        Replace the current file without changing the artifact id or human URL.
        The replacement must use the same format; the prior exact file becomes
        an immutable version available for pinned retrieval and rollback.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: A completed PDF, DOCX, PPTX, or XLSX file, up to 25 MiB.
                title:
                  type: string
                  description: Human-readable title. New artifacts default to the filename.
                visibility:
                  type: string
                  enum:
                    - unlisted
                    - private
                  description: New artifacts only.
                ttl:
                  type: string
                  enum:
                    - 1h
                    - 24h
                    - 7d
                    - never
                  description: New artifacts only.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: File too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        A caller-generated key for safely retrying this execution after a
        network failure. Reusing the same key with the same operation and input
        returns the original result; reusing it for a different call is
        rejected.
      schema:
        type: string
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            billable:
              type: boolean
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your fetchbean API key (fb_…). Keys are not accepted through
        Authorization.

````