# Send your first API request

Make your first call to the gospace API to verify your setup, authenticate successfully, and retrieve live data from your workspace environment.

{% tabs %}
{% tab title="Node.js" %}

### Prerequisites

* Completed **Setup Your Development Environment**
* Node.js v18+ and npm v9+
* A valid gospace API key in your `.env` file

### 1. Install dependencies

If you haven’t already:

```bash
npm install @gospace-ai/api dotenv
```

### 2. Create a request script

Create `first-request.ts`:

```ts
import "dotenv/config";
import GospaceAI from "@gospace-ai/api";

async function main() {
  // Initialize the client with your API key
  const gospace = new GospaceAI(process.env.GOSPACE_API_KEY!, {
    // Optional: use sandbox when available
    // url: "https://sandbox.api.gospace.app",
  });

  // Example: fetch supported countries from the System API
  const res = await gospace.system.getCountries();

  // Print the response data
  console.log(JSON.stringify(res.data, null, 2));
}

main().catch((err) => {
  console.error("Request failed:", err);
  process.exit(1);
});
```

{% hint style="info" %}
Prefer TypeScript? Run with `tsx`. Prefer JavaScript? See the JS version below.
{% endhint %}

### 3. Run the script

With TypeScript (recommended):

```bash
npx tsx first-request.ts
```

{% endtab %}
{% endtabs %}


---

# 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://developer.gospace.com/start-building/send-your-first-api-request.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.
