# Send your first Stripe API request Get started with the Stripe API. Every call to a Stripe API must include an API secret key. After you create a Stripe account, we generate two pairs of [API keys](https://docs.stripe.com/keys.md) for you—a publishable client-side key and a secret server-side key—for both testing in a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes) and in *live* (Use this mode when you’re ready to launch your app. Card networks or payment providers process payments) modes. To start moving real money with your live-mode keys, you must [set up your Stripe account](https://docs.stripe.com/get-started/account/set-up.md). ## Before you begin This guide walks you through a simple interaction with the Stripe API—creating a customer. For a better understanding of Stripe API objects and how they fit together, take a [tour of the API](https://docs.stripe.com/payments-api/tour.md) or visit the [API reference](https://docs.stripe.com/api.md). If you’re ready to start accepting payments, see our [quickstart](https://docs.stripe.com/payments/quickstart-checkout-sessions.md). ## Send your first API request You can begin exploring Stripe APIs using the [Stripe Shell](https://docs.stripe.com/workbench/shell.md). The Stripe Shell allows you to execute Stripe CLI commands directly within the Stripe docs site. As it operates in a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes) environment only, you don’t have to worry about initiating any real money-moving transactions. 1. To [create a customer](https://docs.stripe.com/api/customers/create.md) using the Stripe Shell, enter the following command: #### bash ```bash stripe customers create --email=jane.smith@email.com --name="Jane Smith" --description="My First Stripe Customer" ``` If everything worked, the command line displays the following response: #### bash ```json { "id": "cus_LfctGLAICpokzr", // L'identificatore è simile a questo. "object": "customer", // This is the object logged to your account. "address": null, "balance": 0, "created": 1652283583, "currency": null, "default_source": null, "delinquent": false, "description": "My First Stripe Customer", "discount": null, "email": "jane.smith@email.com", "invoice_prefix": "9B1D61CF", "invoice_settings": { "custom_fields": null, "default_payment_method": null, "footer": null }, "livemode": false, "metadata": { }, "name": "Jane Smith", "next_invoice_sequence": 1, "phone": null, "preferred_locales": [ ], "shipping": null, "tax_exempt": "none", "test_clock": null } ``` 2. (Optional) Run the same command by passing in your API secret key in a sandbox: #### bash ```bash stripe customers create --email=jane.smith@email.com --name="Jane Smith" --description="My First Stripe Customer" --api-key sk_test_BQokikJOvBiI2HlWgH4olfQ2 ``` If everything worked, the command line displays the following response: #### bash ```json { "id": "cus_LfdZgLFhah76qf", // L'identificatore è simile a questo. "object": "customer", // This is the object logged to your account. "address": null, "balance": 0, "created": 1652286103, "currency": null, "default_currency": null, "default_source": null, "delinquent": false, "description": "My First Stripe Customer", "discount": null, "email": "jane.smith@email.com", "invoice_prefix": "D337F99E", "invoice_settings": { "custom_fields": null, "default_payment_method": null, "footer": null }, "livemode": false, "metadata": { }, "name": "Jane Smith", "next_invoice_sequence": 1, "phone": null, "preferred_locales": [ ], "shipping": null, "tax_exempt": "none", "test_clock": null } ``` ## View logs and events Whenever you make a call to Stripe APIs, Stripe creates and stores API and [Events](https://docs.stripe.com/api/events.md) objects for your Stripe [user account](https://docs.stripe.com/get-started/account.md). The API key you specify for the request determines whether the objects are stored in a sandbox environment or in live mode. For example, the last request used your API secret key, so Stripe stored the objects in a sandbox. - To view the API request log: - Open the [Logs](https://dashboard.stripe.com/test/workbench/logs) page. - Click **200 OK POST /v1 customers**. - To view the Event log: - Open the [Events](https://dashboard.stripe.com/test/workbench/events) page. - Click **jane.smith@email.com is a new customer**. ## Store your API keys Quando ti registri per un account Stripe, creiamo tre tipi di chiavi API per te: | Tipo | Sicuro da esporre | Descrizione | | ------------------------------------------ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Chiave API con limitazioni (RAK)`rk_...` | No | Chiave API con autorizzazioni gestite da te. Riduci al minimo i danni che un malintenzionato potrebbe causare alla tua attività se entrasse in possesso della tua chiave. Crea tutte le chiavi RAK che desideri e assegnale a diverse parti della tua applicazione. [Questa guida](https://docs.stripe.com/keys/restricted-api-keys.md) spiega come configurare e utilizzare le chiavi RAK. | | Chiave API pubblicabile | Sì | Chiave API che puoi inserire nel codice front-end o nelle applicazioni che distribuisci. | | Chiave API privata`sk_...` | No | Chiave API con autorizzazioni illimitate su tutte le API Stripe. Poiché non è possibile limitare tali autorizzazioni, sconsigliamo l’uso delle chiavi private per i nuovi casi d’uso; per le integrazioni esistenti, consigliamo invece di passare all’uso delle RAK. | | Chiave API dell’organizzazione`sk_org_...` | No | Chiave API che funziona a livello di organizzazione. Come le chiavi con limitazioni o private a livello di account, ma opera a livello di [organizzazione](https://docs.stripe.com/get-started/account/orgs.md) per gestire più account Stripe contemporaneamente. [Questa guida](https://docs.stripe.com/keys/organization-api-keys.md) spiega come configurare e utilizzare le chiavi API dell’organizzazione. | Accettiamo anche [chiavi API gestite](https://docs.stripe.com/keys/managed-api-keys.md) emesse da alcune piattaforme di hosting. Le chiavi gestite sono chiavi API segrete che una piattaforma di hosting consegna direttamente alle tue applicazioni in hosting. Non è necessario gestire direttamente le chiavi gestite: il tuo provider di hosting le emette e le sostituisce per te. > #### Segreti di firma webhook > > I segreti di firma dei webhook non sono chiavi API: si tratta di segreti specifici per ciascun webhook che il destinatario del webhook utilizza per verificare che i webhook provengano effettivamente da Stripe. Puoi trovare il segreto di firma per ciascun endpoint webhook nella sezione [Webhook](https://dashboard.stripe.com/webhooks) della Dashboard. Se hai creato il tuo account Stripe prima di maggio 2026, potresti non avere chiavi API con limitazioni. Ti consigliamo di creare RAK e migrare dalle chiavi private. Hai la responsabilità della gestione sicura delle tue chiavi API. Leggi la nostra guida alle [best practice per proteggere le chiavi API](https://docs.stripe.com/keys-best-practices.md). ## See also - [Configura il tuo ambiente di sviluppo](https://docs.stripe.com/get-started/development-environment.md) - [Stripe Shell](https://docs.stripe.com/workbench/shell.md)