> For the complete documentation index, see [llms.txt](https://docs.sofarocean.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sofarocean.com/spotter-and-smart-mooring/test-the-api.md).

# Test the API

## Demo API Token

Include this API token in the header or query parameters of your requests to retrieve sample data:

<pre data-expandable="true"><code><code class="expression">space.vars.demo_api_token</code>
</code></pre>

## Walkthrough

{% stepper %}
{% step %}

#### Get a list of Spotters associated with the demo account

Use the [Devices endpoint](/spotter-and-smart-mooring/fetch-devices.md) to retrieve a list of Spotters associated with the demo account, ordered by `spotterId`.

<pre class="language-bash" data-expandable="true"><code class="lang-bash">curl "https://api.sofarocean.com/api/devices" -H 'token: <code class="expression">space.vars.demo_api_token</code>'
</code></pre>

{% endstep %}

{% step %}

#### Get the latest data from the demo account's Spotters

Choose a `spotterId` from the list of Spotters associated with the demo account and use the [Latest Data endpoint](/spotter-and-smart-mooring/spotter-data/latest-data.md) to retrieve the most recently transmitted device, waves and sensor data for that Spotter.

<pre class="language-bash" data-expandable="true"><code class="lang-bash">curl "https://api.sofarocean.com/api/latest-data?spotterId=<code class="expression">space.vars.spotter_id_1</code>" -H 'token: <code class="expression">space.vars.demo_api_token</code>'
</code></pre>

Change the `spotterId` to retrieve the latest data from another one of the demo account's Spotters and/or try adjusting the other [query parameters](/spotter-and-smart-mooring/spotter-data/latest-data.md#query-parameters) (e.g., `includeSurfaceTempData`, `includeWindData` , etc.) to modify which data is returned.
{% endstep %}

{% step %}

#### Get data from that Spotter for a specified time window

Use the [Wave Data endpoint](/spotter-and-smart-mooring/spotter-data/wave-data.md) to retrieve data from one of the demo account's Spotters, specified by `spotterId`, for a given time window. By default, the response will consist of general device information and up to 20 of the most recent data samples.&#x20;

<pre class="language-bash" data-expandable="true"><code class="lang-bash">curl "https://api.sofarocean.com/api/wave-data?spotterId=<code class="expression">space.vars.spotter_id_1</code>" -H 'token: <code class="expression">space.vars.demo_api_token</code>'
</code></pre>

Change the `spotterId` to retrieve the data from another one of the demo account's Spotters and/or try adjusting the other [query parameters](/spotter-and-smart-mooring/spotter-data/wave-data.md#query-parameters) (e.g., `startDate`, `endDate` , `includeBarometerData` etc.) to modify which data is returned.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
You can also use the demo API token to call the Sensor Data and Sensor Configuration Endpoints, but the data arrays in the responses will be empty because the demo account has no registered Smart Mooring devices.
{% endhint %}
