Send your first API request
Prerequisites
1. Install dependencies
npm install @gospace-ai/api dotenv2. Create a request script
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);
});3. Run the script
Last updated
Was this helpful?