configure-authentication
configure-authentication
Set up authentication for Speakeasy CLI commands.
When to Use
- First time setting up Speakeasy CLI
- Getting "unauthorized" errors from commands
- Setting up CI/CD or AI agent environments
- User says: "set up API key", "configure auth", "authentication failed"
Inputs
| Input | Required | Description |
|---|---|---|
| API key | Yes | From Speakeasy Dashboard or browser login |
Outputs
| Output | Description |
|---|---|
| Authenticated CLI | Commands can access Speakeasy services |
Interactive Login (Recommended)
speakeasy auth login
Opens browser for authentication. Credentials stored at ~/.speakeasy/config.yaml.
Non-Interactive (CI/AI Agents)
Set SPEAKEASY_API_KEY environment variable:
export SPEAKEASY_API_KEY="<your-api-key>"
Get your API key: Speakeasy Dashboard → Settings → API Keys
Note: Environment variable takes precedence over config file.
Verifying Authentication
speakeasy status --output json
Returns workspace info as JSON if authenticated; unauthorized error if not.
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
unauthorized |
Missing or invalid API key | Run speakeasy auth login or set SPEAKEASY_API_KEY |
workspace not found |
Wrong workspace configured | Check workspace ID in ~/.speakeasy/config.yaml |
| Token expired | Session timed out | Re-run speakeasy auth login |
Config File Location
Credentials stored at ~/.speakeasy/config.yaml:
speakeasy_api_key: "<your-api-key>"
speakeasy_workspace_id: "<workspace-id>" # optional
# For multiple workspaces:
workspace_api_keys:
org@workspace: "<api-key>"
Related Skills
start-new-sdk-project- Requires auth for quickstartcheck-workspace-status- Verify auth is workingregenerate-sdk- Requires auth for generation
More from speakeasy-api/agent-skills
writing-openapi-specs
Reference guide for OpenAPI specification best practices, naming conventions, and expressing complex REST API patterns like polymorphism, enums, file uploads, and server-sent events. Use when writing or improving OpenAPI specs to ensure they follow established conventions and generate quality SDKs.
16diagnose-generation-failure
Use when SDK generation failed or seeing errors. Triggers on "generation failed", "speakeasy run failed", "SDK build error", "workflow failed", "Step Failed", "why did generation fail
14start-new-sdk-project
>-
14manage-openapi-overlays
Use when creating, applying, or validating overlay files including x-speakeasy extensions. Covers overlay syntax, JSONPath targeting, retries, pagination, naming, grouping, open enums, global headers, custom security. Triggers on "create overlay", "apply overlay", "overlay file", "x-speakeasy", "add extension", "configure retries", "add pagination", "overlay for retries".
13extract-openapi-from-code
Use when extracting or generating an OpenAPI spec from existing API code. Triggers on "extract OpenAPI", "code first", "generate spec from code", "FastAPI OpenAPI", "Spring Boot OpenAPI", "NestJS swagger", "Django OpenAPI", "Flask OpenAPI", "Rails swagger", "Laravel OpenAPI", "existing API code
10speakeasy-context
Speakeasy workflow: run 'agent context' FIRST, do task, run 'agent feedback' LAST. Triggers on speakeasy, SDK, OpenAPI.
10