# How to test API in a local instance

To test API in your local instance, you have the following pre-requisites:

1. Cal.com repo clone. You can get it by following the instructions provided in [installation](https://calcom.gitbook.io/docs/introduction/quick-start/self-hosting/installation "mention")
2. A staging license key that goes in as value for `CALCOM_LICENSE_KEY` in your root `.env` file.
   1. To get the staging license key, please proceed to create a dev account on `console.cal.dev`&#x20;
   2. Next, click on New Deployment

      <figure><img src="https://1247430499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvnsvL4GbkACtu7LWnJSR%2Fuploads%2FJjHxOtTQ05TQhIQqFs6l%2Fdeploy%20step.png?alt=media&#x26;token=6c23b567-8e41-4667-9a52-6de9bba86ffd" alt=""><figcaption></figcaption></figure>
   3. Then, click on Next with Self-hosted selected

      <figure><img src="https://1247430499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvnsvL4GbkACtu7LWnJSR%2Fuploads%2F40qn50MWO2tU9Jduf6PH%2Fdeploy%20type.png?alt=media&#x26;token=d314d0a5-36f9-4ab1-97eb-785c96ee97d7" alt=""><figcaption></figcaption></figure>
   4. Next, type in your deployment name as you like<br>

      <figure><img src="https://1247430499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvnsvL4GbkACtu7LWnJSR%2Fuploads%2Fneq6352niFkiiCrng71l%2Fdeploy%20name.png?alt=media&#x26;token=1ca1a46d-c074-403b-8b14-6f9c3ab91feb" alt=""><figcaption></figcaption></figure>
   5. Finally, you would be taken to the test Stripe payment page. This is where you enter the Stripe test card information. So, simply enter `4242 4242 4242 4242` as the card number, fill the rest as you wish and finish the payment step.<br>

      <figure><img src="https://1247430499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvnsvL4GbkACtu7LWnJSR%2Fuploads%2Ff6kpGm3GdOQC5vyaE9PX%2Fpayment%20step.png?alt=media&#x26;token=5c10c563-1b17-4848-beaa-5375fffd5002" alt=""><figcaption></figcaption></figure>

      Once this is done, you will be redirected to your deployments page containing the list of your deployments. You can then click on the newly created deployment to copy the license key, which is your test license key.<br>

      <figure><img src="https://1247430499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvnsvL4GbkACtu7LWnJSR%2Fuploads%2FmjvNbysci82OsDP2qLdP%2Fdeployment%20keys.png?alt=media&#x26;token=3277a3e2-b294-4dbc-8100-84039f98b730" alt=""><figcaption></figcaption></figure>
3. Next, you need to install API submodule by following the instructions provided in [api-submodule](https://calcom.gitbook.io/docs/introduction/quick-start/self-hosting/installation/platform/api-submodule "mention")
4. Start the cal.com server using `yarn dev` on localhost and create the test API keys by visiting `/settings/developer/api-keys`
5. Start the API server by running `yarn workspace @calcom/api dev` and start testing your API locally

{% hint style="info" %}
By default, the app server runs on port 3000 and the API server runs on port 3002
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://calcom.gitbook.io/docs/how-to-guides/how-to-test-api-in-a-local-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
