> For the complete documentation index, see [llms.txt](https://docs.dispach.moeenmahmud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dispach.moeenmahmud.com/reference/http/dispach-agent-server/write-the-agents-credentials-into-its-env-and-apply-them-reload-or-adopt.md).

# Write the agent's credentials into its .env and apply them: reload or adopt.

```json
{"openapi":"3.1.0","info":{"title":"Dispach agent server","version":"0.1.3"},"servers":[{"url":"http://localhost:7420","description":"Local server. Replace this with the URL of your deployment."}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An operator key or the configured token."}}},"paths":{"/v1/agents/{id}/secrets":{"put":{"summary":"Write the agent's credentials into its .env and apply them: reload or adopt.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"written; `applied` says whether the agent is running on them"},"400":{"description":"a variable the manifest does not read, or an empty value"},"401":{"description":"No credential, or one this server does not accept."},"404":{"description":"No such agent, or it is switched off."},"501":{"description":"this server has no credential writer"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"values":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","code":"secret_value_invalid","hint":"Send each value as a non-empty string.","description":"One variable's value. Written to the agent's .env at 0600; never returned."},"code":"secrets_values_required","hint":"Send { \"values\": { \"MODEL_API_KEY\": \"…\" } }. GET /v1/agents/:id/secrets lists the variables this agent reads.","description":"Variables to write into the agent's .env, keyed by name. Only names the agent's manifest reads are accepted."}},"required":["values"]}}}}}}}}
```
