> ## Documentation Index
> Fetch the complete documentation index at: https://smartcar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing with Postman

> Use the Smartcar Postman collection and a simulated vehicle to make your first API requests without a real car.

Postman is an API client that lets you send requests and inspect responses without writing any code. Pair it with a [simulated vehicle](/docs/getting-started/dashboard/simulator) and you can exercise the whole Smartcar API, including commands and webhooks, before you connect a real vehicle.

By the end of this guide you will have an access token, a simulated vehicle, and a working request that returns vehicle data.

## What you'll need

* A [Postman account](https://identity.getpostman.com/signup) and the [Postman app](https://www.postman.com/downloads/)
* A [Smartcar Dashboard account](https://dashboard.smartcar.com/signup)
* An application on the v3 API. See [API Authentication Setup](/docs/getting-started/how-to/api-authentication) if you aren't sure.

## Step 1: Fork the collection and environment

Smartcar publishes both a collection and an environment in the [Smartcar API workspace](https://www.postman.com/smartcar/smartcar-api) on the Postman API Network.

<Steps>
  <Step title="Fork the collection">
    Open the [Smartcar API Collection](https://www.postman.com/smartcar/smartcar-api/collection/btrmn6x/smartcar-api-collection) and select **Fork** to copy it into your own workspace.
  </Step>

  <Step title="Fork the environment">
    Do the same for the **SmartcarApi Variables** environment in that workspace. It holds the base URLs plus the placeholders you fill in below.
  </Step>

  <Step title="Select the environment">
    In Postman, choose **SmartcarApi Variables** from the environment selector. Requests fail with unresolved `{{variable}}` errors if no environment is selected.
  </Step>
</Steps>

The environment defines these variables:

| Variable                                                    | Description                                           |
| ----------------------------------------------------------- | ----------------------------------------------------- |
| `clientId`                                                  | Your application's client ID                          |
| `clientSecret`                                              | A client secret you generate in the Dashboard         |
| `accessToken`                                               | Set automatically when you run **Client Credentials** |
| `vehicleId`                                                 | The vehicle you want to query                         |
| `userId`                                                    | The user the vehicle is connected to                  |
| `iamUrl`, `vehicleUrl`, `managementUrl`, `compatibilityUrl` | Smartcar base URLs, prefilled                         |

## Step 2: Add your API credentials

In the [Smartcar Dashboard](https://dashboard.smartcar.com), go to **Configuration > API credentials**. Copy your **Client ID**, then generate a **Client Secret**.

<Frame type="simple">
  <img src="https://mintcdn.com/smartcar-docs/S66Ua8RkDi2eA3eH/images/help-center/guide-postman/dashboard-api-credentials.png?fit=max&auto=format&n=S66Ua8RkDi2eA3eH&q=85&s=049ff6011a5185085c1a667f5e86f668" alt="API credentials tab in the Smartcar Dashboard Configuration page" width="2832" height="1110" data-path="images/help-center/guide-postman/dashboard-api-credentials.png" />
</Frame>

Paste both values into the `clientId` and `clientSecret` variables in your Postman environment.

<Warning>
  The client secret is shown only once, and it grants access to every vehicle connected to your application. Store it somewhere secure and never commit it or share a Postman workspace that contains it.
</Warning>

## Step 3: Get an access token

Run the **Client Credentials** request. It posts your credentials to the token endpoint and returns an application-level access token:

```json theme={null}
{
  "access_token": "{access_token}",
  "token_type": "Bearer",
  "expires_in": 3600
}
```

The request has a test script that writes `access_token` into the `accessToken` environment variable, so every other request in the collection picks it up automatically.

<Note>
  Access tokens are valid for **1 hour** and there is no refresh token. When requests start failing, run **Client Credentials** again. See [Request an access token](/docs/api-reference/authorization/request-access-token) for the full reference.
</Note>

## Step 4: Create a simulated vehicle

In the Dashboard, open the **Simulator** tab and select **Add simulated vehicle**. Choose a powertrain type, give the vehicle a name, and leave **Automatically connect to application** enabled so the vehicle is ready to query straight away.

<Frame type="simple">
  <img src="https://mintcdn.com/smartcar-docs/kZvsv_2Mbka_0Bgd/images/dashboard/simulator/dashboard-simulator-create.png?fit=max&auto=format&n=kZvsv_2Mbka_0Bgd&q=85&s=a78cac3be1e3958258864af947b49495" alt="Add simulated vehicle modal in the Smartcar Dashboard" width="2832" height="1446" data-path="images/dashboard/simulator/dashboard-simulator-create.png" />
</Frame>

The powertrain type you pick (BEV, PHEV, HEV, or ICE) determines which signals and commands are available. Simulated vehicles are granted all compatible permissions by default.

Once the vehicle is created, copy its **Vehicle ID** and **User ID** from the Simulator table into the `vehicleId` and `userId` environment variables in Postman.

<Note>
  Simulated vehicles appear in your connections and logs with `Simulated` as the make and the powertrain type as the model, for example `2023 Simulated BEV`.
</Note>

## Step 5: Confirm the connection

Run the **Connections** request to list the vehicles connected to your application. To see only simulated vehicles, enable the `filter[vehicle.mode]` query parameter and set it to `simulated`.

Your new vehicle should appear with the same ID you copied in the previous step. If it doesn't, the vehicle was likely created in a disconnected state, so connect it from the Simulator before continuing.

## Step 6: Read vehicle data

With `accessToken`, `vehicleId`, and `userId` all set, run:

* **Vehicle** to get the vehicle's details
* **Signals** to read every signal the vehicle exposes
* **Signal** to read one signal, for example `charge-chargetimers`

Signal requests send the user's ID in the `sc-user-id` header, which the collection populates from `{{userId}}`. A request that returns an authorization error is usually missing that variable.

## Step 7: Send a command

Simulated vehicles support these commands:

* [Lock and unlock](/docs/api-reference/control-lock-unlock)
* [Start and stop charge](/docs/api-reference/evs/control-charge)
* [Set charge limit](/docs/api-reference/evs/set-charge-limit)
* [Send destination](/docs/api-reference/send-destination-to-vehicle)

Run **Commands security/lock**, then return to the vehicle in the Simulator and select **Refresh** to see the updated state.

## Step 8: Change the vehicle state

The Simulator gives you direct control over the vehicle's data. Open the vehicle's **Vehicle state** tab, edit any signals you want, and select **Publish**. Re-run your Postman requests and the responses reflect the new state.

<Frame type="simple">
  <img src="https://mintcdn.com/smartcar-docs/spAMSpoZi1t6eVNh/images/dashboard/simulator/dashboard-simulator-v2.png?fit=max&auto=format&n=spAMSpoZi1t6eVNh&q=85&s=1ddfb11eb2c54f3a66e1ea8213aef4ab" alt="Configuring vehicle signals in the Smartcar Vehicle Simulator" width="2832" height="1690" data-path="images/dashboard/simulator/dashboard-simulator-v2.png" />
</Frame>

This is also how you reproduce errors. For example, set `Transmission.GearState` to `DRIVE` and a lock command returns a `VEHICLE_STATE:IN_MOTION` error, or uncheck a permission under `VehicleUserAccount.Permissions` and the matching request returns a permission error.

<Note>
  Simulated vehicles have no rate limits and no command latency, so responses come back immediately. Live vehicles behave differently on both counts.
</Note>

## Testing Smartcar Connect in simulated mode

The steps above use application-level tokens, which is the recommended way to reach both live and simulated vehicles. If your integration uses the OAuth 2.0 authorization code flow instead, you can rehearse the vehicle owner's experience against a simulated vehicle.

<Steps>
  <Step title="Create the vehicle disconnected">
    Turn off **Automatically connect to application** when creating the simulated vehicle, or disconnect an existing one.
  </Step>

  <Step title="Open the Connect modal">
    Select **Connect manually via Smartcar Connect** to get a Connect URL with `mode=simulated` and the credentials to sign in with.
  </Step>

  <Step title="Complete the flow">
    Launch the URL, pick any brand, and sign in with the generated credentials.
  </Step>
</Steps>

<Frame type="simple">
  <img src="https://mintcdn.com/smartcar-docs/kZvsv_2Mbka_0Bgd/images/dashboard/simulator/smartcar-connect-simulated-mode.png?fit=max&auto=format&n=kZvsv_2Mbka_0Bgd&q=85&s=29a6dbd1c20bf44186f9e5ce6e73e590" alt="Smartcar Connect running in simulated mode" width="1916" height="1662" data-path="images/dashboard/simulator/smartcar-connect-simulated-mode.png" />
</Frame>

<Note>
  The simulated Connect flow uses `response_type=none`, so it does not return a per-vehicle access token. To receive an authorization code you can exchange, launch Connect with `response_type=code` and a configured redirect URI.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="My requests return an unresolved variable error">
    Select the **SmartcarApi Variables** environment in Postman. Without it, `{{clientId}}` and the other placeholders are never substituted.
  </Accordion>

  <Accordion title="Requests that worked a moment ago now fail to authorize">
    Access tokens expire after 1 hour and there is no refresh token. Run **Client Credentials** again to mint a new one.
  </Accordion>

  <Accordion title="I'm getting a permission error on a signal or command">
    Check that the permission is still granted. Simulated vehicles grant all compatible permissions by default, but they can be toggled off under the `VehicleUserAccount.Permissions` signal. See [Permissions](/docs/api-reference/permissions).

    Also confirm the signal or command is supported by the powertrain type you chose.
  </Accordion>

  <Accordion title="My simulated vehicle doesn't appear in Connections">
    The vehicle was probably created with **Automatically connect to application** turned off, or it was disconnected later. Connect it from the Simulator, then run **Connections** again.
  </Accordion>
</AccordionGroup>

## What's next

<Card title="Test your webhooks" icon="webhook" href="/docs/integrations/webhooks/overview" horizontal="true">
  Subscribe a simulated vehicle to an integration and trigger deliveries by publishing state changes.
</Card>

<Card title="Browse the signals catalog" icon="signal" href="/docs/api-reference/signals-catalog" horizontal="true">
  See every signal you can read and configure.
</Card>

<Card title="Generate a client" icon="code" href="/docs/api-reference/openapi-specs" horizontal="true">
  Download the raw OpenAPI documents to generate code or feed the schema into your own tooling.
</Card>
