Cohere API Key
Detects Cohere API keys. Cohere issues an opaque 40-character alphanumeric token with no distinctive vendor prefix, so this pattern requires an adjacent Cohere label (cohere / CO_API_KEY / COHERE_API_KEY) to structurally qualify a match.
- Type
- regex
- Engine
- universal
- Confidence
- medium
- Confidence justification
- Medium confidence: Cohere's own documentation does not publish the token's visible format; GitGuardian's detector spec and the community-maintained gitleaks ruleset both confirm the key is an unprefixed, opaque 40-character alphanumeric string. Without an adjacent Cohere label the value is indistinguishable from any other 40-character alphanumeric string (a hash, an ID, or unrelated token), so this pattern requires the label and offers no unlabelled/value-only tier.
- Jurisdictions
- global
- Regulations
- Criminal Code Act 1995 (Cth)
- Frameworks
- CIS Controls, ISO 27001, NIST CSF, SOC 2
- Data categories
- credentials, security
- Scope
- narrow
- Risk rating
- 9
- Platform compatibility
- Purview: Compatible, GCP DLP: Unsupported, Macie: Unsupported, Zscaler: Compatible, Palo Alto: Unsupported, Netskope: Unsupported
Pattern
(?i)(?:cohere|co_api_key|cohere_api_key)[\s\S]{0,40}?[=:][\s"']{0,4}(?<![a-z0-9_-])[a-z0-9]{40}(?![a-z0-9_-])
Corroborative evidence keywords
cohere, cohere.ai, CO_API_KEY, COHERE_API_KEY, command r, rerank, api key, api_key, apikey, access key, access token, auth token, authorization, bearer, conn str, connection string, connectionstring, cookie, credential, database (+39 more)
Proximity: 300 characters
Should match
CO_API_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD— Cohere key in the canonical CO_API_KEY env var (label + 40-char body)cohere_api_key: zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgG— Cohere key labelled with the cohere_api_key aliasCOHERE_API_KEY=ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrq9876— Cohere key in the COHERE_API_KEY env var alias with = separator (zero-entropy 40-char body)
Should not match
Random 40-char token: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij0123 with no vendor context— Bare 40-char alphanumeric value with no Cohere label anywhere (could be any hash or ID)cohere api key too short: ABCDEFGHIJ0123456789— Cohere label present but value far too short (20 chars, not 40)please rotate the cohere api key before shipping— Prose mention without a token valueUsing cohere with key ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij0123— Free-standing 40-char alphanumeric in prose after a "cohere" label but no assignment separator (boundary regression case from review)template example placeholder record identifier— Template/sample context should be excluded even when anchor words are present
Known false positives
- A 40-character hash, GUID, or unrelated token that happens to appear near the word "cohere" in documentation. Mitigation: Require the assignment-style label adjacency (already enforced by the regex) plus corroborative keywords; exclude placeholder markers.
- Documentation or examples showing placeholder CO_API_KEY values. Mitigation: Check for placeholder markers (example, xxxx, 0000) and documentation file types to reduce false positives.