How to Get Your Stripe API Key

Learn how to find and create your Stripe API keys step by step. Understand test vs live keys, security best practices, and how to integrate Stripe data into your application.

Kateryna PoryvayKateryna Poryvay

Kateryna Poryvay

4 min read
How to Get Your Stripe API Key

Stripe provides API keys that let you integrate payment processing, billing, and financial data into your applications. This guide walks through finding and creating API keys in the Stripe Dashboard.

For a unified approach to accounting integrations, check out the Apideck Stripe connector, which lets you pull Stripe data alongside 30+ other accounting platforms through a single API.

What is Stripe?

Stripe is a payment processing platform that enables businesses to accept online payments and manage recurring billing. Through its API, you can access financial data including customers, invoices, payments, subscriptions, and transaction history.

Prerequisites

Before you start, make sure you have:

Finding Your API Keys

Stripe provides two types of API keys: publishable keys (for client-side code) and secret keys (for server-side code). Each type has both test and live versions.

  1. Log into the Stripe Dashboard.
  2. Click Developers in the left sidebar.
  3. Select API keys from the menu.

Your publishable key (pk_live_ or pk_test_) and secret key (sk_live_ or sk_test_) are displayed here. In test mode, you can reveal the secret key as many times as needed. In live mode, you can only reveal a secret key once, so copy and store it immediately.

Creating a Restricted API Key

For better security, you can create restricted keys that limit access to specific resources. This is recommended when integrating with third-party services.

  1. In the API keys page, click Create restricted key.
  2. Give the key a descriptive name.
  3. Set permissions for each resource type. For read-only integrations, select Read for the resources you need access to.
  4. Click Create key.

Common permissions for accounting integrations include read access to: Customers, Charges, PaymentIntents, Invoices, Subscriptions, and Products.

Test Mode vs Live Mode

Stripe maintains separate environments for testing and production:

  • Test mode uses keys starting with pk_test_ and sk_test_. No real money is processed.
  • Live mode uses keys starting with pk_live_ and sk_live_. Real transactions occur.

Toggle between modes using the Test mode switch in the Dashboard. Make sure you're using the correct keys for your environment.

Common Mistakes

Exposing your secret key: Never include your secret key in client-side code, commit it to version control, or share it publicly. Treat it like a password.

Using test keys in production: If your integration isn't processing real payments, verify you're using live mode keys, not test keys.

Overly permissive keys: Use restricted keys with minimal permissions rather than your main secret key. This limits potential damage if a key is compromised.

Forgetting to rotate keys: If you suspect a key has been exposed, roll it immediately from the API keys page.

Rate Limits

Stripe's API enforces rate limits to ensure platform stability. The default limit for most endpoints is 25 requests per second, though Stripe may increase this for accounts with higher usage. Some endpoints have stricter limits (the Search API and Files API are limited to 20 operations per second). Test mode has lower limits than live mode. If you exceed these limits, Stripe returns a 429 Too Many Requests response.

For high-volume integrations, implement exponential backoff and cache frequently accessed data.

Connecting Stripe via Apideck

Apideck's unified Accounting API lets you connect to Stripe alongside platforms like QuickBooks and Sage through a single integration.

Note that Apideck's Stripe connector uses OAuth rather than standard API keys. You'll need to create a Stripe App first to get your Client ID, Client Secret, and Channel Link ID. See our How to Create a Stripe App guide for the full walkthrough.

Configuring the Connector

With your Stripe App credentials ready, open the Apideck dashboard and navigate to Configuration > Accounting > Stripe.

How to Get Your Stripe API Key 1

Enter your Client ID and Client Secret, then scroll down to configure scopes and add your Channel Link ID.

How to Get Your Stripe API Key 2

What Your Users See

When your users connect their Stripe account through Vault, they'll be prompted for their Stripe Account ID (found under Settings > Account details in Stripe, starts with acct_).

How to Get Your Stripe API Key 3

After authorization, Stripe data flows through Apideck's unified API alongside your other accounting integrations.

Ready to connect to Stripe and 30+ other accounting platforms through a single API? Get started for free.

Ready to get started?

Scale your integration strategy and deliver the integrations your customers need in record time.

Ready to get started?
Talk to an expert

Trusted by fast-moving product & engineering teams

JobNimbus
Blue Zinc
Exact
Drata
Octa
Apideck Blog

Insights, guides, and updates from Apideck

Discover company news, API insights, and expert blog posts. Explore practical integration guides and tech articles to make the most of Apideck's platform.