Skip to main content

Installation

npm install vepler-sdk

Basic Usage

import { Vepler } from 'vepler-sdk';

// Initialize the SDK
const vepler = new Vepler({
  apiKey: process.env.VEPLER_API_KEY // Your x-api-key
});

// Make your first request
const response = await vepler.property.get('p_0x000123456789');

// Response includes data wrapper
console.log(response.data);
// { id: 'p_0x000123456789', address: '...', propertyType: '...', ... }

Authentication

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

Available Modules

The SDK provides access to three main modules:

Property Module

Access property data through various methods:
// 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

Access planning application data:
// 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 service health status:
// Check property service health
const propertyHealth = await vepler.health.getV1PropertyHealth();

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

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

Error Handling

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

  if (response.errorResponse) {
    console.error('API Error:', response.errorResponse.error);
    console.error('Error Code:', response.errorResponse.code);
  } else if (response.propertyListResponse) {
    console.log('Success:', response.propertyListResponse.result);
  }
} catch (error) {
  // Network or other errors
  console.error('Request failed:', error);
}

TypeScript Support

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

// All parameters and responses are typed
const request: GetV1PropertyLocationIdsRequest = {
  locationIds: 'UK-123',
  limit: '10'
};

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

Response Structure

All SDK methods return a response object that may contain either the successful response or an error:
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);

Pagination

Handle paginated responses using limit and offset:
async function getAllProperties(locationId: string) {
  const properties = [];
  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);

      // Check if we've retrieved all properties
      if (properties.length >= response.propertyListResponse.totalSize) {
        break;
      }

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

  return properties;
}

Advanced Configuration

Configure the SDK with custom settings:
import { Vepler } from 'vepler-sdk';

const vepler = new Vepler({
  apiKey: process.env.VEPLER_API_KEY,
  // Additional configuration
  timeout: 30000,
  baseURL: 'https://api.vepler.com' // Optional, defaults to production
});

API Reference

For detailed API documentation, see:

Contact

For support: hello@vepler.com
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.