Skip to main content

Prerequisites

Before you begin, make sure you have:
  • A Voyant account with workspace access
  • Your API key (generate from workspace settings)
  • Basic understanding of REST APIs
  • A tool to make HTTP requests (cURL, Postman, or code)
Never expose your API key in client-side code or public repositories. Always keep it secure on your server.

Get your API key

1

Log in to your dashboard

Navigate to https://dash.voyantcloud.com and sign in to your workspace.
2

Open settings

Click on your workspace settings icon in the sidebar navigation.
3

Generate API key

Under the API Keys section, click Generate New Key. Copy the key immediately as it will only be shown once.
Store your API key securely in environment variables or a secrets manager.

Make your first request

Let’s fetch your product catalog to verify authentication works.
curl https://api.voyantcloud.com/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY"
[
  {
    "id": "prod_01h8z3y4x2w1v0u9t8s7r6q5p4",
    "title": "Paris City Tour",
    "status": "active",
    "type": "tour",
    "currency": "EUR",
    "created_at": "2024-01-15T10:00:00Z"
  },
  {
    "id": "prod_01h8z4y5x3w2v1u0t9s8r7q6p5",
    "title": "Rome Food Experience",
    "status": "active",
    "type": "experience",
    "currency": "EUR",
    "created_at": "2024-01-20T14:30:00Z"
  }
]
If you see a list of products, your API key is working correctly! 🎉

Get product details

Now let’s fetch detailed information about a specific product:
curl https://api.voyantcloud.com/v1/products/prod_01h8z3y4x2w1v0u9t8s7r6q5p4 \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "id": "prod_01h8z3y4x2w1v0u9t8s7r6q5p4",
  "title": "Paris City Tour",
  "description": "Discover the magic of Paris with our comprehensive city tour...",
  "status": "active",
  "type": "tour",
  "duration_days": 1,
  "currency": "EUR",
  "location": {
    "city": "Paris",
    "country": "FR"
  },
  "media": [
    {
      "url": "https://cdn.voyantcloud.com/products/paris-tour-1.jpg",
      "type": "image",
      "sort": 0
    }
  ],
  "created_at": "2024-01-15T10:00:00Z",
  "updated_at": "2024-01-15T10:00:00Z"
}

Calculate a price

Use the pricing endpoint to get real-time price calculations with taxes and rules applied:
curl -X POST https://api.voyantcloud.com/v1/departures/dept_01h9xm2n3p4q5r6s7t8v9w0x1y/price \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "productId": "prod_01h8z3y4x2w1v0u9t8s7r6q5p4",
    "pax": {
      "adults": 2,
      "children": 1,
      "infants": 0
    }
  }'
{
  "breakdown": {
    "base": {
      "label": "Base",
      "amount": 150.00
    },
    "lines": [
      {
        "label": "Per person",
        "qty": 3,
        "unitAmount": 50.00,
        "amount": 150.00
      }
    ],
    "taxes": [
      {
        "rate": 19,
        "amount": 28.50,
        "jurisdiction": null
      }
    ]
  },
  "net": 150.00,
  "tax": 28.50,
  "gross": 178.50,
  "total": 178.50,
  "taxesIncluded": false
}

Error handling

The API uses standard HTTP status codes and returns detailed error messages:
{
  "error": "Unauthorized"
}
Always check the HTTP status code first, then parse the error message from the response body.

Response headers

Every API response includes helpful headers:
X-Request-ID: f47ac10b-58cc-4372-a567-0e02b2c3d479
X-RateLimit-Limit: 3000
X-RateLimit-Remaining: 2988
X-RateLimit-Reset: 1704067200
Content-Type: application/json
  • X-Request-ID: Unique identifier for the request (include when reporting issues)
  • X-RateLimit-*: Rate limiting information
  • Content-Type: Always application/json

Next steps

Now that you’ve made your first requests, explore more advanced features:

Common patterns

Environment variables

Store your API key in environment variables:
  • .env file
  • Shell export
VOYANT_API_KEY=your_api_key_here
VOYANT_API_URL=https://api.voyantcloud.com

Base request function

Create a reusable function for API requests:
async function voyantRequest(endpoint, options = {}) {
  const response = await fetch(
    `${process.env.VOYANT_API_URL}${endpoint}`,
    {
      ...options,
      headers: {
        Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
        'Content-Type': 'application/json',
        ...options.headers
      }
    }
  );

if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'API request failed');
}

return response.json();
}

// Usage
const products = await voyantRequest('/v1/products');

You’re now ready to build your travel booking integration with Voyant! 🚀