---
title: "Add or update secret file"
method: PUT
path: "/build-sources/{buildSourceId}/secret-files/{envVarKey}"
tags: ["Build Sources"]
---

# Add or update secret file

`PUT /build-sources/{buildSourceId}/secret-files/{envVarKey}`

## Request

- Base URL: `https://api.render.com/v1`
- URL: `https://api.render.com/v1/build-sources/{buildSourceId}/secret-files/{envVarKey}`
- Auth: HTTP bearer

Add or update a particular secret file for a particular build source.

This only applies to secret files set directly on the build source, not to secret files in a linked environment group.

## Request body

- object
  - `content` string

## Response `201`

Created

- SecretFile
  - `name` string, required
  - `content` string, required

## Other responses

- `400`: The request could not be understood by the server.
- `401`: Authorization information is missing or invalid.
- `403`: You do not have permissions for the requested resource. If a scoped API token does not satisfy the endpoint's minimum scope requirements, the response has code insufficient_token_scope and its message lists all minimum required scopes. Broader scopes that include their permissions also satisfy the requirements. Passing this check does not guarantee access to the requested resource or to conditional operations.
- `404`: Unable to find the requested resource.
- `406`: Unable to generate preferred media types as specified by Accept request header.
- `410`: The requested resource is no longer available.
- `429`: Rate limit has been surpassed. Rate-limited endpoints also return `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` on successful responses so clients can track their remaining quota.
- `500`: An unexpected server error has occurred.
- `503`: Server currently unavailable.

## Changes

- **2026-11-03** `6ac5d3d47362`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/render/apis/render-public-api/changes/build-sources/:buildSourceId/secret-files/:envVarKey/put.md)

---

[API](https://skmtc.dev/render/apis/render-public-api.md) - [All operations](https://skmtc.dev/render/apis/render-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/render/apis/render-public-api/revisions/6ac5d3d47362?raw)
