---
updatedAt: 2026-06-04T20:26:28.000Z
agentTools:
  projectIndex: https://api-docs.render.com/llms.txt
---

# Add or update secret file

Add or update a particular secret file for a particular service.

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


# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "Render Public API",
    "description": "Manage everything about your Render services",
    "version": "1.0.0",
    "contact": {
      "name": "Render API",
      "url": "https://community.render.com",
      "email": "support@render.com"
    }
  },
  "x-readme": {
    "metrics-enabled": false
  },
  "servers": [
    {
      "url": "https://api.render.com/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Services",
      "description": "[Services](https://render.com/docs/service-types) allow you to manage your web services, private services, background workers, cron jobs, and static sites.\n"
    }
  ],
  "paths": {
    "/services/{serviceId}/secret-files/{envVarKey}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/serviceIdParam"
        },
        {
          "name": "envVarKey",
          "in": "path",
          "required": true,
          "description": "The file name of the secret file",
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "summary": "Add or update secret file",
        "description": "Add or update a particular secret file for a particular service.\n\nThis only applies to secret files set directly on the service, not to secret files in a linked environment group.\n",
        "operationId": "add-or-update-secret-file",
        "tags": [
          "Services"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "content": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/secretFile"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/401Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/403Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/404NotFound"
          },
          "406": {
            "$ref": "#/components/responses/406NotAcceptable"
          },
          "410": {
            "$ref": "#/components/responses/410Gone"
          },
          "429": {
            "$ref": "#/components/responses/429RateLimit"
          },
          "500": {
            "$ref": "#/components/responses/500InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/503ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "serviceIdParam": {
        "name": "serviceId",
        "in": "path",
        "required": true,
        "description": "The ID of the service",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "error": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "A stable, machine-readable identifier present on specific errors that clients can handle specially. Each endpoint documents the codes it can return. The errorCode schema lists the full vocabulary of codes."
          }
        }
      },
      "secretFile": {
        "type": "object",
        "required": [
          "name",
          "content"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "content": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "400BadRequest": {
        "description": "The request could not be understood by the server.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "401Unauthorized": {
        "description": "Authorization information is missing or invalid.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "403Forbidden": {
        "description": "You do not have permissions for the requested resource.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "404NotFound": {
        "description": "Unable to find the requested resource.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "406NotAcceptable": {
        "description": "Unable to generate preferred media types as specified by Accept request header.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "410Gone": {
        "description": "The requested resource is no longer available.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "429RateLimit": {
        "description": "Rate limit has been surpassed.\n\nRate-limited endpoints also return `RateLimit-Limit`, `RateLimit-Remaining`, and\n`RateLimit-Reset` on successful responses so clients can track their remaining quota.\n",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying the request.",
            "schema": {
              "type": "integer",
              "example": 30
            }
          },
          "RateLimit-Limit": {
            "description": "Maximum number of requests allowed in the current window.",
            "schema": {
              "type": "integer",
              "example": 100
            }
          },
          "RateLimit-Remaining": {
            "description": "Number of requests remaining in the current window. Always `0` for this response.",
            "schema": {
              "type": "integer",
              "example": 0
            }
          },
          "RateLimit-Reset": {
            "description": "Seconds until the current rate limit window resets.",
            "schema": {
              "type": "integer",
              "example": 30
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            },
            "example": {
              "message": "rate limit exceeded"
            }
          }
        }
      },
      "500InternalServerError": {
        "description": "An unexpected server error has occurred.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      },
      "503ServiceUnavailable": {
        "description": "Server currently unavailable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/error"
            }
          }
        }
      }
    }
  }
}
```