MCPcopy Create free account
hub / github.com/e2b-dev/E2B / validate_api_key

Function validate_api_key

packages/python-sdk/e2b/api/__init__.py:88–97  ·  view source on GitHub ↗

Validate that an E2B API key has the expected ``e2b_`` prefix followed by hex characters. Raises ``AuthenticationException`` otherwise.

(api_key: str)

Source from the content-addressed store, hash-verified

86
87
88def validate_api_key(api_key: str) -> None:
89 """Validate that an E2B API key has the expected ``e2b_`` prefix
90 followed by hex characters. Raises ``AuthenticationException`` otherwise.
91 """
92 if not _API_KEY_PATTERN.match(api_key):
93 raise AuthenticationException(
94 'Invalid API key format: expected "e2b_" followed by hex '
95 f'characters (e.g. "{_API_KEY_EXAMPLE}"). '
96 "Visit the API Keys tab at https://e2b.dev/dashboard?tab=keys to get your API key."
97 )
98
99
100class ApiClient(AuthenticatedClient):

Calls 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…