|
| 1 | +# Credential pins: `credentialIds` lists |
| 2 | + |
| 3 | +An assistant, a squad member's `assistantOverrides` and a squad's |
| 4 | +`membersOverrides` can each carry a `credentialIds` list. It pins a call to |
| 5 | +specific keys, for example one site's Azure OpenAI key in an org that holds a |
| 6 | +key per site. This page explains what the list does on a call and what |
| 7 | +`npm run validate` checks about it. |
| 8 | + |
| 9 | +## What a list does |
| 10 | + |
| 11 | +A `credentialIds` list is not a choice for one provider. It is the full set |
| 12 | +of keys the call may use: |
| 13 | + |
| 14 | +- As soon as any assistant on the call has a list, the call can use only the |
| 15 | + listed keys. Every squad member's list is pooled into one list for the |
| 16 | + whole call, so a list on one member narrows the other members too. |
| 17 | +- A provider whose key is not on the list does not fail. The model, voice or |
| 18 | + transcriber runs on Vapi's own key, a tool or server request goes out |
| 19 | + without its key, and the recording does not go to your storage bucket. |
| 20 | +- The phone number's own credential stays usable whatever the list says. |
| 21 | + |
| 22 | +So a list has to name every key the call needs: the model key, the voice |
| 23 | +key, the transcriber key, each key a tool or server names in `credentialId`, |
| 24 | +the storage bucket key and the Langfuse key if the org has them. |
| 25 | + |
| 26 | +Lists combine like this: |
| 27 | + |
| 28 | +| Where the list is | What happens | |
| 29 | +| --- | --- | |
| 30 | +| On the assistant | Kept. Lists from overrides are added to it. | |
| 31 | +| In a member's `assistantOverrides` | Used, unless the squad's `membersOverrides` also has a list, which replaces it. | |
| 32 | +| In the squad's `membersOverrides` | Applies to every member. | |
| 33 | + |
| 34 | +One list per squad, in `membersOverrides`, is the simplest layout: shared |
| 35 | +assistants carry no list, and each squad names its own keys. |
| 36 | + |
| 37 | +```yaml |
| 38 | +# resources/<org>/squads/south-front-desk.yml |
| 39 | +name: South Front Desk |
| 40 | +members: |
| 41 | + - assistantId: triage |
| 42 | + - assistantId: pharmacy |
| 43 | +membersOverrides: |
| 44 | + credentialIds: |
| 45 | + - azure-south # this site's Azure OpenAI key |
| 46 | + - elevenlabs # voice |
| 47 | + - deepgram # transcriber |
| 48 | + - crm-webhook # the key the lookup tool names |
| 49 | + - recordings # storage bucket |
| 50 | +``` |
| 51 | +
|
| 52 | +## What validate checks |
| 53 | +
|
| 54 | +`npm run validate -- <org>` (and `apply`, which runs it first) reports a list |
| 55 | +that leaves out a key **the org has saved** for something the call uses: |
| 56 | + |
| 57 | +| The call uses | Reported when | |
| 58 | +| --- | --- | |
| 59 | +| A model, voice or transcriber, or a fallback voice or transcriber | The org has a key for that provider and the list has none. An OpenAI model can run on an `openai` key or an `azure-openai` key, so either on the list is enough. Every other provider takes a key saved under its own name. | |
| 60 | +| A tool, server or model that names a key in `credentialId` | That key is not on the list. | |
| 61 | +| Storage | The org has a storage bucket key and the list has none. | |
| 62 | +| Langfuse | The org has a Langfuse key and the list leaves it out. | |
| 63 | + |
| 64 | +It does not report a provider the org has no key of its own for. Running |
| 65 | +that provider on Vapi's key is a normal setup, with or without a list. |
| 66 | + |
| 67 | +A different key for the same provider counts as a key for it. A squad pinned |
| 68 | +to one site's Azure OpenAI key is not told about the other sites' keys. |
| 69 | + |
| 70 | +For a squad, the check looks at the call as a whole: the pooled list, and |
| 71 | +what every member uses after its overrides are applied. An assistant with a |
| 72 | +list of its own is also checked on its own, since it can be called outside a |
| 73 | +squad. |
| 74 | + |
| 75 | +The finding is `credential-pin-hides-key`: |
| 76 | + |
| 77 | +```text |
| 78 | +⚠️ [credential-pin-hides-key] squads/south-front-desk (credentialIds): the voice of member "triage" and the voice of member "pharmacy" use 11labs, and this org has "elevenlabs" saved for it, but the call's credentialIds list ("azure-south", "deepgram") has no key for 11labs. A call that has a credentialIds list can use only the keys on it, so 11labs would run on Vapi's own key, not yours. Add the key to the list |
| 79 | +``` |
| 80 | + |
| 81 | +### Limits |
| 82 | + |
| 83 | +- The check reads files. A squad member that is not a file in the org's |
| 84 | + folder (a dashboard-owned assistant) adds nothing to it. |
| 85 | +- It knows each key's provider, not which models or regions the key covers. |
| 86 | + A list with an Azure OpenAI key that does not serve the assistant's model |
| 87 | + passes. |
| 88 | +- A tool or server with no `credentialId` is not checked. |
| 89 | +- Lists added at call time (`assistantOverrides` on a call or a phone |
| 90 | + number) are outside the repo and are not seen. |
| 91 | + |
| 92 | +## Orgs that must only use their own keys |
| 93 | + |
| 94 | +By default the finding is a warning. For an org whose calls must never run |
| 95 | +on Vapi's keys, add a policy file and commit it: |
| 96 | + |
| 97 | +```yaml |
| 98 | +# resources/<org>/.vapi-policy.yml |
| 99 | +customerKeysOnly: true |
| 100 | +``` |
| 101 | + |
| 102 | +In that org the finding is an error: `validate` fails, `apply` stops before |
| 103 | +it pulls or pushes, and the **Validate resources** check fails on the pull |
| 104 | +request. `npm run push` on its own only blocks on errors with `--strict`, |
| 105 | +like every other validation error. |
| 106 | + |
| 107 | +The policy belongs to one org. Promotion does not copy it, so set it in each |
| 108 | +org that needs it. An unknown key in the file stops `validate`, so a typo |
| 109 | +can't switch the rule off. |
| 110 | + |
| 111 | +The policy makes a hidden key an error. It does not require the org to have |
| 112 | +a key for every provider it uses. |
| 113 | + |
| 114 | +## How the check knows what each key is for |
| 115 | + |
| 116 | +The state file maps a credential's name to its UUID and nothing else. Pull |
| 117 | +also records each key's provider in |
| 118 | +`resources/<org>/.vapi-credential-providers.json`: |
| 119 | + |
| 120 | +```json |
| 121 | +{ |
| 122 | + "azure-south": { "provider": "azure-openai" }, |
| 123 | + "elevenlabs": { "provider": "11labs" }, |
| 124 | + "recordings": { "bucket": true, "provider": "azure" } |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +Commit it with the state file. It holds no secret. Every pull rewrites it, |
| 129 | +including `npm run pull -- <org> --bootstrap`, which changes no resource |
| 130 | +file. If the file is missing or older than the state file, the check reports |
| 131 | +`credential-pin-unchecked` and asks for that pull. |
| 132 | + |
| 133 | +Give every key a name in Vapi before the first pull. Two keys with no name |
| 134 | +and the same provider get the same name here, and only one is kept. Pull |
| 135 | +warns when that happens. |
| 136 | + |
| 137 | +## Promotion |
| 138 | + |
| 139 | +A credential with the binding policy `omit` is dropped from a promoted file. |
| 140 | +For a single `credentialId` that is the point. For an entry in a |
| 141 | +`credentialIds` list it narrows what calls in the destination may use, so |
| 142 | +the plan says so: |
| 143 | + |
| 144 | +```text |
| 145 | +release: dev → prod |
| 146 | + update squads/south-front-desk.yml |
| 147 | + ⚠️ squads/south-front-desk.yml: credentialIds entry "elevenlabs" is left out in prod (binding policy "omit"). Calls there can use only the keys still on the list, so that provider would run on Vapi's own key. |
| 148 | +``` |
| 149 | + |
| 150 | +See [Promotion](promotion.md) for bindings. |
0 commit comments