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

# Write text file contents to Devbox filesystem.

> Write UTF-8 string contents to a file at path on the Devbox. Note for large files (larger than 100MB), the upload_file endpoint must be used.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json post /v1/devboxes/{id}/write_file_contents
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/devboxes/{id}/write_file_contents:
    post:
      tags:
        - Devbox
        - Devbox-FileTools
      summary: Write text file contents to Devbox filesystem.
      description: >-
        Write UTF-8 string contents to a file at path on the Devbox. Note for
        large files (larger than 100MB), the upload_file endpoint must be used.
      operationId: devboxWriteFileContents
      parameters:
        - name: id
          in: path
          description: The Devbox ID.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevboxWriteFileParameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevboxExecutionDetailView'
        '404':
          description: Devbox not found.
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Runloop from '@runloop/api-client';


            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });


            const devboxExecutionDetailView = await
            client.devboxes.writeFileContents('id', {
              contents: 'contents',
              file_path: 'file_path',
            });


            console.log(devboxExecutionDetailView.devbox_id);
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            devbox_execution_detail_view = client.devboxes.write_file_contents(
                id="id",
                contents="contents",
                file_path="file_path",
            )
            print(devbox_execution_detail_view.devbox_id)
components:
  schemas:
    DevboxWriteFileParameters:
      type: object
      properties:
        file_path:
          type: string
          description: >-
            The path to write the file to on the Devbox. Path is relative to
            user home directory.
        contents:
          type: string
          description: The UTF-8 string contents to write to the file.
      required:
        - file_path
        - contents
    DevboxExecutionDetailView:
      type: object
      properties:
        devbox_id:
          type: string
          description: Devbox id where command was executed.
        stdout:
          type: string
          description: Standard out generated by command.
        stderr:
          type: string
          description: Standard error generated by command.
        exit_status:
          type: integer
          format: int32
          description: Exit status of command execution.
        shell_name:
          description: Shell name.
          type:
            - string
            - 'null'
      required:
        - devbox_id
        - stdout
        - stderr
        - exit_status
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````