Skip to main content

Installation

npm install @vepler/sdk

Basic Usage

import { SDK } from '@vepler/sdk';

// Initialise the SDK
const vepler = new SDK({
  apiKey: process.env.VEPLER_API_KEY
});

// Make your first request
const response = await vepler.property.getV1PropertyLocationIds({
  locationIds: 'p_0x000123456789'
});

if (response.propertyListResponse) {
  console.log(response.propertyListResponse.result);
}

Authentication

The SDK uses x-api-key header authentication. Get your API key from the Vepler dashboard.
const vepler = new SDK({
  apiKey: 'vpr_live_...'
});

Available Modules

The SDK provides access to all API modules:

Property Module

// Get properties by location IDs
const locationResponse = await vepler.property.getV1PropertyLocationIds({
  locationIds: 'UK-12345678,UK-87654321',
  limit: '10',
  offset: '0'
});

// Get properties by property IDs
const propertyResponse = await vepler.property.getV1PropertyPropertyIdPropertyIds({
  propertyIds: 'PROP-123,PROP-456'
});

// Get properties by source IDs
const sourceResponse = await vepler.property.getV1PropertySourcesSourceIds({
  sourceIds: 'provider-a::123,provider-b::456'
});

// Get properties by slugs
const slugResponse = await vepler.property.postV1PropertyPropertiesBySlugs({
  slugs: ['property-slug-1', 'property-slug-2'],
  limit: 25
});

// Query properties with advanced filters
const queryResponse = await vepler.property.postV1PropertyQuery({
  area: [{
    type: 'postcode',
    value: 'SW1A'
  }],
  query: {
    priceMin: 250000,
    priceMax: 500000,
    beds: [2, 3]
  },
  limit: 25,
  offset: 0
});

Planning Module

// Get planning applications by IDs
const planningResponse = await vepler.planning.getV1PlanningApplicationIds({
  applicationIds: 'APP-123,APP-456'
});

// Get planning applications by source IDs
const planningSourceResponse = await vepler.planning.getV1PlanningSourcesSourceIds({
  sourceIds: 'council-a::APP/2024/0001'
});

// Query planning applications
const planningQueryResponse = await vepler.planning.postV1PlanningQuery({
  query: {
    councils: ['Westminster', 'Camden'],
    statuses: ['approved', 'pending_decision'],
    receivedDateFrom: '2024-01-01',
    receivedDateTo: '2024-12-31'
  },
  limit: 50,
  offset: 0,
  sortBy: 'receivedDate',
  sortOrder: 'desc'
});

Health Module

// Check property service health
const propertyHealth = await vepler.system.getV1PropertyHealth();

// Check planning service health
const planningHealth = await vepler.system.getV1PlanningHealth();

if (propertyHealth.healthResponse?.status === 'healthy') {
  console.log('Property service is operational');
}

Error Handling

The SDK returns typed responses with proper error handling:
const response = await vepler.property.getV1PropertyLocationIds({
  locationIds: 'UK-123'
});

// Check for successful response
if (response.propertyListResponse) {
  console.log('Total properties:', response.propertyListResponse.totalSize);
  console.log('Properties:', response.propertyListResponse.result);
}

// Check for error response
if (response.errorResponse) {
  console.error('Error:', response.errorResponse.error);
}

// HTTP metadata is also available
console.log('Status:', response.statusCode);
console.log('Headers:', response.headers);

TypeScript Support

The SDK is fully typed. All request and response types are available:
import { SDK } from '@vepler/sdk';
import type {
  PropertyQueryRequest,
  PropertyListResponse,
  PlanningApplication,
  ErrorResponse
} from '@vepler/sdk/models/components';
import type {
  GetV1PropertyLocationIdsRequest,
  GetV1PropertyLocationIdsResponse
} from '@vepler/sdk/models/operations';

const request: GetV1PropertyLocationIdsRequest = {
  locationIds: 'UK-123',
  limit: '10'
};

const response: GetV1PropertyLocationIdsResponse =
  await vepler.property.getV1PropertyLocationIds(request);

Pagination

Handle paginated responses using limit and offset:
async function getAllProperties(locationId: string) {
  const properties: unknown[] = [];
  let offset = 0;
  const limit = 100;

  while (true) {
    const response = await vepler.property.getV1PropertyLocationIds({
      locationIds: locationId,
      limit: String(limit),
      offset: String(offset)
    });

    if (response.propertyListResponse) {
      properties.push(...response.propertyListResponse.result);

      if (properties.length >= response.propertyListResponse.totalSize) {
        break;
      }

      offset += limit;
    } else {
      break;
    }
  }

  return properties;
}

Advanced Configuration

import { SDK } from '@vepler/sdk';

const vepler = new SDK({
  apiKey: process.env.VEPLER_API_KEY,
  serverURL: 'https://api.vepler.com' // Optional, defaults to production
});

API Reference

This SDK is auto-generated using Speakeasy from our OpenAPI specification. The SDK is regenerated whenever the API changes to ensure it stays in sync.