> ## AI Agent Context > Get the complete documentation index at: https://aistudio.google.com/llms.txt > Use this file to discover all available pages. > For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt # Uploading an environment file {% callout type="note" %} This API is in Beta. Endpoints are under `/v1beta/`. {% /callout %} {% mark class="http-put" %}{% icon name="north_east" /%}`PUT`{% /mark %} `https://generativelanguage.googleapis.com/upload/v1beta/environments/{environment}/files/{path}` Starts a resumable upload session for a file in an environment workspace. Upload the file bytes to the URL returned in the `X-Goog-Upload-URL` response header, using the resumable upload protocol. {% two-column-layout %} {% left-column %} ## Parameters {% class="hide-from-toc" id="parameters" %} {% section class="api-ref-property-list" %} **X-Goog-Upload-Command**: {% mark %}required{% /mark %} `string` Command that starts the resumable upload session. Default: `start` {% hr /%} **X-Goog-Upload-Header-Content-Length**: {% mark %}required{% /mark %} `integer` Total number of file bytes that will be uploaded to the session URL. {% hr /%} **X-Goog-Upload-Header-Content-Type**: {% mark %}required{% /mark %} `string` MIME type of the file that will be uploaded to the session URL. {% hr /%} **X-Goog-Upload-Protocol**: {% mark %}required{% /mark %} `string` Resumable upload protocol selector. Default: `resumable` {% hr /%} **extract**: `boolean` Optional. If true, treats the uploaded file as a tar/tar.gz archive and unpacks it into `path`. {% hr /%} **overwrite**: `boolean` Optional. Whether to overwrite the destination file if it already exists. {% /section %} {% /left-column %} {% right-column class="sticky" %} **Example request** {% class="example-heading" %} {% tabs %} {% tab label="REST" %} ```sh curl -i -X PUT \ 'https://generativelanguage.googleapis.com/upload/v1beta/environments/env_abc123/files/main.py?overwrite=true' \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H 'X-Goog-Upload-Protocol: resumable' \ -H 'X-Goog-Upload-Command: start' \ -H "X-Goog-Upload-Header-Content-Length: $(wc -c < main.py)" \ -H 'X-Goog-Upload-Header-Content-Type: text/x-python' ``` {% /tab %} {% /tabs %} {% /right-column %} {% /two-column-layout %} ## Response {% class="hide-from-toc" id="response" %} Empty response.