Secrets
Store API keys and tokens once, and reference them from Python without hard-coding credentials.
Secrets are credentials your Python needs — API keys, tokens, webhook URLs — stored once under Settings → Secrets and read by name at runtime.
Without them, a key that three actions need is pasted into three actions, shows up in version history, and has to be found and replaced everywhere when it rotates.
Saving through MCP
Use create_organization_secret with organizationId, name, value, and an
optional description to save a new credential. Python can then read it with
get_secret("NAME"). Existing names are rejected.
Use list_organization_secrets to find a secret's ID, then pass it as secretId
to update_organization_secret or archive_organization_secret, along with
organizationId. Updates accept any of name, description, or value; omit
value to preserve the stored credential. Renaming requires updating Python
references to the old name. Deleting makes the credential unavailable to Python.
The tools return metadata only and redact the value from MCP logs and audit records. Your MCP client may retain the submitted value in its conversation history. Use the dashboard if you do not want to submit it through a client.
Changing one JSON connection setting
Ask Copilot to change the specific setting in the named secret. It can use
patch_organization_secret_json without reading or re-entering the stored
password. The saved value must be a JSON object.
First call list_organization_secrets. Pass the returned id as secretId
and its opaque revision as expectedRevision, along with organizationId:
{
"organizationId": "YOUR_ORGANIZATION_UUID",
"secretId": "YOUR_SECRET_UUID",
"expectedRevision": "REVISION_FROM_THE_METADATA_LIST",
"set": { "permissionMode": "supplied-credential" }
}This example deliberately changes the SQL connection's permission policy. Read the SQL Server trust modes before selecting it. It is not required for ordinary secret patches.
setreplaces top-level fields. An object or array replaces that entire field, rather than merging its contents.nullstores JSON null.removeis an optional array of top-level names to delete. Missing names are ignored. A name cannot appear in bothsetandremove.- Omitted fields, including passwords, stay unchanged. At least one field must be supplied. The resulting secret has the usual 20,000-character limit.
- The revision detects concurrent changes, including credential rotation. If it is stale, re-list metadata and review the intended patch before retrying. Do not automatically overwrite a newer change.
Only metadata is returned: id, name, description, hint, lastUsedAt,
createdAt, updatedAt, and revision. Neither existing JSON field names nor
values are returned. Submitted field names and values are omitted from MCP
audit arguments and application logs, but may remain in the client's history.
The REST equivalent is PATCH /rest/v1/secrets/{id}/json, authenticated with
the organization's X-API-Key. Send the same expectedRevision, set and
remove fields in the body. Obtain the ID and revision from
GET /rest/v1/secrets. The response is { "data": metadata } with the same
metadata fields as MCP; stale revisions return HTTP 409. REST API keys have
organization-wide access, while read-only MCP sessions cannot patch secrets.
Using one
def execute_action(context):
key = get_secret("MONDAY_API_KEY")
response = requests.post(
"https://api.monday.com/v2",
headers={"Authorization": key},
json={"query": "{ boards(limit: 1) { id name } }"},
timeout=30,
)
response.raise_for_status()
return response.json()Full reference: get_secret.
Values cannot be read back
Once saved, a secret's value is write-only. It is not shown in the dashboard, not returned by the REST API, and not readable by Copilot. The only way to read it is get_secret inside a Python execution.
To help you confirm you saved the right thing, each secret shows a short code such as ****4f2a. That code is derived from the value by a one-way hash — it is not part of the secret, and it does not reveal any of it.
Editing a secret lets you change its name or description without re-entering the value. Leave the value field blank to keep the stored one.
How they are protected
- Encrypted at rest with AES-256-GCM. The stored form is authenticated, so a tampered value fails loudly rather than decrypting to something wrong.
- Only the secrets you ask for are transmitted to the Python sandbox, and only when a script actually calls
get_secret. - Scrubbed from output. Values are stripped from
stdout,stderrand your action's return value before Octocom logs or displays them.
Scrubbing recognises the value exactly as stored. A value you have sliced, encoded or rebuilt piece by piece will pass straight through — so never deliberately print or return a secret, even partially.
Anyone who can write Python in your organization can read that organization's secrets. That is the point of the feature, and it is worth remembering when you decide who gets access to the action editor.