Skip to main content
1

Get Your API Key

Sign up for an account at context.dev then copy and securely store your API key, you’ll need it for all API requests.
2

Install SDK & Usage

Installation

Install the official context.dev npm package:
npm install context.dev

Basic Usage

import ContextDev from "context.dev";

const client = new ContextDev({
  apiKey: process.env["CONTEXT_DEV_API_KEY"], // Set your API key
});

// Retrieve brand data for a domain
const brand = await client.brand.retrieve({ domain: "airbnb.com" });
console.log(brand.brand);

Complete Example

import ContextDev from "context.dev";

const client = new ContextDev({
  apiKey: "your-api-key-here",
});

async function getBrandData(domain: string) {
  try {
    const response = await client.brand.retrieve({ domain });

    console.log("Company:", response.brand.title);
    console.log("Description:", response.brand.description);
    console.log("Colors:", response.brand.colors);
    console.log("Logos:", response.brand.logos);

    return response.brand;
  } catch (error) {
    if (error instanceof ContextDev.APIError) {
      console.error("API Error:", error.status, error.message);
    } else {
      console.error("Error:", error);
    }
    throw error;
  }
}

// Usage
getBrandData("meta.com").then(console.log);

TypeScript Support

The package includes full TypeScript definitions:
import ContextDev from "context.dev";

const client = new ContextDev({
  apiKey: process.env["CONTEXT_DEV_API_KEY"],
});

const params: ContextDev.BrandRetrieveParams = { domain: "google.com" };
const brand: ContextDev.BrandRetrieveResponse = await client.brand.retrieve(
  params
);

Installation

Install the official context.dev Python package:
pip install context.dev

Basic Usage

import context_dev
import os

client = context_dev.ContextDev(
    api_key=os.environ.get("CONTEXT_DEV_API_KEY"),
)

# Retrieve brand data for a domain
brand = client.brand.retrieve(domain="airbnb.com")
print(brand.brand)

Complete Example

import context_dev
import os

def get_brand_data(domain):
    client = context_dev.ContextDev(
        api_key="your-api-key-here",
    )

    try:
        response = client.brand.retrieve(domain=domain)
        brand = response.brand

        print(f"Company: {brand.title}")
        print(f"Description: {brand.description}")
        print(f"Colors: {brand.colors}")
        print(f"Logos: {brand.logos}")

        return brand
    except context_dev.APIError as e:
        print(f"API Error: {e.status_code} - {e.message}")
        raise
    except Exception as e:
        print(f"Error: {e}")
        raise

# Usage
brand_data = get_brand_data("meta.com")

Error Handling

try:
    brand = client.brand.retrieve(domain="example.com")
except context_dev.APIError as e:
    if e.status_code == 404:
        print("Brand not found")
    elif e.status_code == 401:
        print("Invalid API key")
    else:
        print(f"API error: {e.status_code}")

Installation

Add the context.dev gem to your Gemfile:
gem 'context.dev'
Then run:
bundle install
Or install directly:
gem install context.dev

Basic Usage

require 'context_dev'

client = ContextDev::Client.new(
  api_key: ENV['CONTEXT_DEV_API_KEY']
)

# Retrieve brand data for a domain
brand = client.brand.retrieve(domain: 'airbnb.com')
puts brand.brand

Complete Example

require 'context_dev'

def get_brand_data(domain)
  client = ContextDev::Client.new(
    api_key: 'your-api-key-here'
  )

  begin
    response = client.brand.retrieve(domain: domain)
    brand = response.brand

    puts "Company: #{brand.title}"
    puts "Description: #{brand.description}"
    puts "Colors: #{brand.colors}"
    puts "Logos: #{brand.logos}"

    brand
  rescue ContextDev::APIError => e
    puts "API Error: #{e.status} - #{e.message}"
    raise
  rescue => e
    puts "Error: #{e.message}"
    raise
  end
end

# Usage
brand_data = get_brand_data('meta.com')
begin
  brand = client.brand.retrieve(domain: 'example.com')
rescue ContextDev::APIError => e
  case e.status
  when 404
    puts "Brand not found"
  when 401
    puts "Invalid API key"
  else
    puts "API error: #{e.status}"
  end
end

Endpoints & Response Structure

To view all endpoints and their respective responses, please visit the API documentation below.

API Reference

Explore all available endpoints and parameters
Need help implementing a specific use case? Contact our team for personalized guidance.