> 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.sofarocean.com/spotter-and-smart-mooring/test-the-api.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.
