Skip to content
TriedDocs
Account

Update public key

Change the domains, agents, reCAPTCHA and fraud settings of a public key.

PATCHhttps://api.tried.com.au/public-keys/{id}

Needs keys Updates a public key. The public_key value stays the same, so pages that embed it keep working. Fields you leave out keep their current value. Real reCAPTCHA checks need RECAPTCHA_SECRET on the server; without it they run in mock mode.

Request#

Path parameter Type Description
id string The public_key_id, for example pk_4a7e1c9b2d0f5e83a6c1b7d2.
Field Type Required Description
name string No Label, 1 to 80 characters.
allowed_domains string[] No Replaces the domain list. 1 to 20 entries: example.com, *.example.com or localhost, each with an optional :port.
agent_id string or null No Voice agent for web calls. null removes it, after which web calls with this key return 403.
chat_agent_id string or null No Chat agent for chats.
chat_agents object[] No Replaces the A/B split: up to 10 { "chat_agent_id", "weight" } entries. Send [] to go back to chat_agent_id.
recaptcha_enabled boolean No Require a reCAPTCHA v3 token.
recaptcha_threshold number No Lowest accepted score, 0 to 1.
rate_limit_per_minute integer or null No Key-wide limit, 1 to 10000. null removes it.
blocked_countries string[] No Replaces the list of two-letter country codes to reject.

Every agent you name must exist in the workspace. See Create public key for how each setting is enforced.

Example request#

curl -X PATCH https://api.tried.com.au/public-keys/pk_4a7e1c9b2d0f5e83a6c1b7d2 \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recaptcha_threshold": 0.7, "blocked_countries": ["RU"]}'
const res = await fetch("https://api.tried.com.au/public-keys/pk_4a7e1c9b2d0f5e83a6c1b7d2", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ recaptcha_threshold: 0.7, blocked_countries: ["RU"] }),
});
const key = await res.json();
import os, requests

res = requests.patch(
    "https://api.tried.com.au/public-keys/pk_4a7e1c9b2d0f5e83a6c1b7d2",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={"recaptcha_threshold": 0.7, "blocked_countries": ["RU"]},
)
key = res.json()

Response#

200 OK

{
  "public_key_id": "pk_4a7e1c9b2d0f5e83a6c1b7d2",
  "name": "Website widget",
  "public_key": "public_key_9c2e4f7a1b3d5e6f8a0c2e4b6d8f1a3c",
  "chat_agent_id": "chat_agent_1e5b9d3f7a2c4e6b8d0f2a4c",
  "allowed_domains": ["example.com.au", "*.example.com.au"],
  "created_timestamp": 1760313600000,
  "chat_agents": [],
  "agent_id": "agent_2f8d4b6a0c1e3f5a7b9d1c3e",
  "recaptcha_enabled": true,
  "recaptcha_threshold": 0.7,
  "rate_limit_per_minute": 60,
  "blocked_countries": ["RU"]
}

Errors#

Status When
400 A field fails validation, for example a domain that is not example.com, *.example.com or localhost.
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the admin scope. Dashboard members get The member role is read-only.
404 Public key not found, or a named agent does not exist (Chat agent ... not found, Agent ... not found).
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.