Skip to content

CCDV-F · Domain 7: Security and Safety · 8% of the exam

Task 7.3: API Key and Credential Handling

Keeping Anthropic API keys and other credentials inside their intended scope: calls proxied through a server instead of keys in the client, workspace keys versus admin keys, separate environments, rotation and watching how keys are used.

Study it

  • API keys: server-side proxying, workspace and admin keys, environments and rotation

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

Ten minutes ago a developer pushed a commit that may contain your production API key to a public repository. The key serves live traffic, and you need to stop any misuse right away while keeping the option to bring the same key back if the review shows it was never exposed. What should you do in the Claude Console first?

  1. ADelete the key, since a deleted key can be restored from the Console within the review period
  2. BDisable the key, which stops it working and can be reversed with Re-enable
  3. CDelete the repository's Actions secret that stores the key, which retires the key
  4. DLower the workspace spend limit so that misuse costs less while the review runs
Show the answer and why
  • ADelete the key, since a deleted key can be restored from the Console within the review period

    Incorrect

    Delete is permanent; only Disable can be reversed.

  • BDisable the key, which stops it working and can be reversed with Re-enable

    Correct

    Disable is reversible, while Delete is permanent.

  • CDelete the repository's Actions secret that stores the key, which retires the key

    Incorrect

    Deleting a secret leaves the credential it held valid; the key itself must be disabled or deleted.

  • DLower the workspace spend limit so that misuse costs less while the review runs

    Incorrect

    A spend limit caps cost but does not stop someone else from using the key.

Store keys in a secrets manager, rotate them periodically, and disable or delete any key you suspect has leaked. In the Claude Console, Disable is reversible (Re-enable returns the key to active), whereas Delete is permanent.

Question 2 · choose 1

Your mobile app calls the Claude API. A developer proposes shipping the API key inside the app so that it can call the API directly. What does Anthropic's guidance say?

  1. AShip it, but obfuscate it in the app binary
  2. BShip it, and rotate it every few months
  3. CShip a different key in each app release
  4. DKeep the key out of client-side code and call the API from your own server
Show the answer and why
  • AShip it, but obfuscate it in the app binary

    Incorrect

    The key must stay out of client-side code altogether.

  • BShip it, and rotate it every few months

    Incorrect

    Rotation does not make a key in client code safe.

  • CShip a different key in each app release

    Incorrect

    Every shipped key is still in client-side code.

  • DKeep the key out of client-side code and call the API from your own server

    Correct

    Keys belong out of source control, client-side code and prompts.

Keep API keys out of source control, client-side code and prompts. A client app should call your own server, which holds the key and calls the API.

Question 3 · choose 1

Your service uses an API key that isn't scoped to a workspace, and its requests must run in the team's analytics workspace. What must each request include?

  1. AThe workspace name in the model field
  2. BNothing: unscoped keys always use the Default Workspace
  3. CThe workspace ID in the anthropic-workspace-id header
  4. DThe workspace ID as a query parameter on the URL
Show the answer and why
  • AThe workspace name in the model field

    Incorrect

    The model field names a model, not a workspace.

  • BNothing: unscoped keys always use the Default Workspace

    Incorrect

    An unscoped key must name the workspace on each request.

  • CThe workspace ID in the anthropic-workspace-id header

    Correct

    A key not scoped to a workspace needs the workspace ID in that header.

  • DThe workspace ID as a query parameter on the URL

    Incorrect

    The workspace is selected with the header.

If your key isn't scoped to a workspace, specify the workspace ID in the anthropic-workspace-id header for each request; a request that omits it is rejected rather than sent to a default workspace.

Practice domain 7 →Practice all domains →