Understanding the API Response
The Brand.dev API returns a structured JSON response with the following main sections:Loom.com Sample Response
Copy
{
"status": "ok",
"brand": {
"domain": "loom.com",
"title": "Loom",
"description": "Loom is a video messaging platform that enables users to record their screen, camera, or both, to communicate more effectively. Now part of Atlassian, Loom empowers remote teams to work asynchronously and make the impossible possible with video messaging, championing a remote-first work culture.",
"slogan": "Empowering everyone to communicate more effectively, wherever they are",
"colors": [
{
"hex": "#040404",
"name": "Armor Wash"
},
{
"hex": "#655ef3",
"name": "Blue Hepatica"
},
{
"hex": "#acace2",
"name": "Maximum Blue Purple"
}
],
"logos": [
{
"url": "https://media.brand.dev/41361aac-0659-4a12-b4ab-e6b13276f6ad.jpg",
"mode": "has_opaque_background",
"colors": [
{
"hex": "#655ef3",
"name": "Blue Hepatica"
},
{
"hex": "#e3e3f3",
"name": "Crystal Falls"
}
],
"resolution": {
"width": 720,
"height": 720,
"aspect_ratio": 1
},
"type": "icon"
},
{
"url": "https://media.brand.dev/660ae867-d4a1-4c38-a815-6dbc1ceb33d5.svg",
"mode": "light",
"colors": [
{
"hex": "#0c1414",
"name": "Ruined Smores"
}
],
"resolution": {
"width": 150,
"height": 48,
"aspect_ratio": 3.13
},
"type": "logo"
},
{
"url": "https://media.brand.dev/48bab401-ef69-40ee-9a4b-20290d93b558.svg",
"mode": "light",
"colors": [
{
"hex": "#040404",
"name": "Armor Wash"
}
],
"resolution": {
"width": 84,
"height": 25,
"aspect_ratio": 3.36
},
"type": "logo"
}
],
"backdrops": [
{
"url": "https://media.brand.dev/cbfda606-244b-4fde-9aaf-6ccc9d597a20.png",
"colors": [
{
"hex": "#3fa9d5",
"name": "Summer Air"
},
{
"hex": "#2c2554",
"name": "Ceremonial Purple"
},
{
"hex": "#d5c1d7",
"name": "Tender Violet"
}
],
"resolution": {
"width": 1500,
"height": 500,
"aspect_ratio": 3
}
},
{
"url": "https://media.brand.dev/94e5b368-6d5b-4021-ac00-c2970ed6b53a.png",
"colors": [
{
"hex": "#2b1c52",
"name": "Pāua"
},
{
"hex": "#77596a",
"name": "Exotic Orchid"
},
{
"hex": "#dddfed",
"name": "Artemis Silver"
}
],
"resolution": {
"width": 1200,
"height": 627,
"aspect_ratio": 1.91
}
},
{
"url": "https://media.brand.dev/59118ae5-3db4-4e6e-97f4-d914d53981c6.png",
"colors": [
{
"hex": "#1c6ad7",
"name": "Flickr Blue"
},
{
"hex": "#edb638",
"name": "Baklava"
},
{
"hex": "#53442e",
"name": "Deep Bronze"
}
],
"resolution": {
"width": 1128,
"height": 191,
"aspect_ratio": 5.91
}
}
],
"address": {
"street": "140 2nd Street",
"city": "San Francisco",
"country": "United States",
"country_code": "US",
"state_province": "California",
"state_code": "CA",
"postal_code": "94105"
},
"socials": [
{
"type": "x",
"url": "https://x.com/loom"
},
{
"type": "facebook",
"url": "https://facebook.com/useloom"
},
{
"type": "linkedin",
"url": "https://linkedin.com/company/useloom"
},
{
"type": "youtube",
"url": "https://youtube.com/channel/ucnqj2rfvx8v0t377wcojyoa"
}
],
"stock": null,
"phone": "3017125913",
"is_nsfw": false,
"industries": {
"eic": [
{
"industry": "Technology",
"subindustry": "Software (B2B)"
}
]
},
"links": {
"careers": null,
"terms": "https://loom.com/legal",
"contact": "https://loom.com/connect/enterprise",
"privacy": null,
"blog": "https://loom.com/newsroom",
"pricing": "https://loom.com/pricing"
}
},
"code": 200
}
Basic Data Extraction
Extract Basic Company Information
Copy
import json
# Parse the input JSON string
input_data = json.loads(input_data.get('inputData', '{}'))
# Extract basic company information
brand = input_data.get('brand', {})
output = {
'company_name': brand.get('title', ''),
'domain': brand.get('domain', ''),
'description': brand.get('description', ''),
'slogan': brand.get('slogan', ''),
'email': brand.get('email', ''),
'phone': brand.get('phone', ''),
'is_nsfw': brand.get('is_nsfw', False)
}
Extract Contact Information
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Extract contact information
output = {
'email': brand.get('email', ''),
'phone': brand.get('phone', ''),
'domain': brand.get('domain', '')
}
# Extract address information
address = brand.get('address', {})
if address:
output.update({
'street': address.get('street', ''),
'city': address.get('city', ''),
'state': address.get('state_province', ''),
'state_code': address.get('state_code', ''),
'country': address.get('country', ''),
'country_code': address.get('country_code', ''),
'postal_code': address.get('postal_code', '')
})
Logo and Visual Assets
Extract All Logo URLs
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Extract all logo URLs
logos = brand.get('logos', [])
logo_urls = [logo.get('url', '') for logo in logos if logo.get('url')]
output = {
'logo_urls': logo_urls,
'logo_count': len(logo_urls)
}
Find Best Logo for Different Use Cases
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Initialize variables
largest_resolution = None
smallest_resolution = None
best_icon_dark = None
best_icon_light = None
best_logo_dark = None
best_logo_light = None
# Process logos
for logo in brand.get('logos', []):
resolution = logo.get('resolution', {})
width = resolution.get('width', 0)
height = resolution.get('height', 0)
area = width * height
# Find largest and smallest resolutions
if largest_resolution is None or area > largest_resolution[1]:
largest_resolution = (logo.get('url', ''), area)
if smallest_resolution is None or area < smallest_resolution[1]:
smallest_resolution = (logo.get('url', ''), area)
# Find best icons for dark/light modes
if logo.get('type') == 'icon':
if logo.get('mode') == 'dark':
best_icon_dark = logo.get('url', '')
elif logo.get('mode') == 'light':
best_icon_light = logo.get('url', '')
# Process backdrops for logos
for backdrop in brand.get('backdrops', []):
if backdrop.get('mode') == 'dark':
best_logo_dark = backdrop.get('url', '')
elif backdrop.get('mode') == 'light':
best_logo_light = backdrop.get('url', '')
output = {
'largest_logo': largest_resolution[0] if largest_resolution else '',
'smallest_logo': smallest_resolution[0] if smallest_resolution else '',
'best_icon_dark': best_icon_dark,
'best_icon_light': best_icon_light,
'best_logo_dark': best_logo_dark,
'best_logo_light': best_logo_light
}
Extract Logo Metadata
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
logos_info = []
for logo in brand.get('logos', []):
logo_data = {
'url': logo.get('url', ''),
'type': logo.get('type', ''),
'mode': logo.get('mode', ''),
'width': logo.get('resolution', {}).get('width', 0),
'height': logo.get('resolution', {}).get('height', 0),
'aspect_ratio': logo.get('resolution', {}).get('aspect_ratio', 0)
}
logos_info.append(logo_data)
output = {
'logos': logos_info,
'logo_count': len(logos_info)
}
Color Palette Extraction
Extract All Colors
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Extract all colors
colors = brand.get('colors', [])
color_list = []
for color in colors:
color_list.append({
'hex': color.get('hex', ''),
'name': color.get('name', '')
})
output = {
'colors': color_list,
'color_count': len(color_list)
}
Extract Primary and Secondary Colors
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
colors = brand.get('colors', [])
primary_colors = []
secondary_colors = []
for color in colors:
color_name = color.get('name', '').lower()
if 'primary' in color_name or 'main' in color_name:
primary_colors.append(color.get('hex', ''))
elif 'secondary' in color_name or 'accent' in color_name:
secondary_colors.append(color.get('hex', ''))
output = {
'primary_colors': primary_colors,
'secondary_colors': secondary_colors,
'all_colors': [color.get('hex', '') for color in colors]
}
Extract Logo Colors
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
logo_colors = []
for logo in brand.get('logos', []):
for color in logo.get('colors', []):
logo_colors.append({
'hex': color.get('hex', ''),
'name': color.get('name', ''),
'logo_url': logo.get('url', '')
})
output = {
'logo_colors': logo_colors,
'unique_logo_colors': list(set([color['hex'] for color in logo_colors if color['hex']]))
}
Social Media and Links
Extract Social Media Links
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
socials = brand.get('socials', [])
social_links = {}
for social in socials:
social_type = social.get('type', '').lower()
social_url = social.get('url', '')
if social_url:
social_links[social_type] = social_url
output = {
'social_links': social_links,
'facebook': social_links.get('facebook', ''),
'twitter': social_links.get('twitter', ''),
'instagram': social_links.get('instagram', ''),
'linkedin': social_links.get('linkedin', ''),
'youtube': social_links.get('youtube', '')
}
Extract Important Links
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
links = brand.get('links', {})
output = {
'careers': links.get('careers', ''),
'privacy': links.get('privacy', ''),
'terms': links.get('terms', ''),
'contact': links.get('contact', ''),
'blog': links.get('blog', ''),
'pricing': links.get('pricing', '')
}
Industry and Classification
Extract Industry Information
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
industries = brand.get('industries', {})
eic_industries = []
for industry in industries.get('eic', []):
eic_industries.append({
'industry': industry.get('industry', ''),
'subindustry': industry.get('subindustry', '')
})
output = {
'industries': eic_industries,
'primary_industry': eic_industries[0].get('industry', '') if eic_industries else '',
'primary_subindustry': eic_industries[0].get('subindustry', '') if eic_industries else ''
}
Financial Information
Extract Stock Information
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
stock = brand.get('stock', {})
output = {
'ticker': stock.get('ticker', ''),
'exchange': stock.get('exchange', ''),
'has_stock_info': bool(stock.get('ticker'))
}
Complete Data Extraction
Extract Everything in One Go
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Basic information
output = {
'company_name': brand.get('title', ''),
'domain': brand.get('domain', ''),
'description': brand.get('description', ''),
'slogan': brand.get('slogan', ''),
'email': brand.get('email', ''),
'phone': brand.get('phone', ''),
'is_nsfw': brand.get('is_nsfw', False)
}
# Colors
colors = brand.get('colors', [])
output['colors'] = [{'hex': c.get('hex', ''), 'name': c.get('name', '')} for c in colors]
output['primary_color'] = colors[0].get('hex', '') if colors else ''
# Logos
logos = brand.get('logos', [])
output['logo_count'] = len(logos)
output['logo_urls'] = [logo.get('url', '') for logo in logos if logo.get('url')]
# Social media
socials = brand.get('socials', [])
output['social_links'] = {s.get('type', '').lower(): s.get('url', '') for s in socials}
# Address
address = brand.get('address', {})
if address:
output.update({
'address_street': address.get('street', ''),
'address_city': address.get('city', ''),
'address_state': address.get('state_province', ''),
'address_country': address.get('country', ''),
'address_postal': address.get('postal_code', '')
})
# Stock
stock = brand.get('stock', {})
output['stock_ticker'] = stock.get('ticker', '')
output['stock_exchange'] = stock.get('exchange', '')
# Industries
industries = brand.get('industries', {}).get('eic', [])
output['industries'] = [{'industry': i.get('industry', ''), 'subindustry': i.get('subindustry', '')} for i in industries]
# Links
links = brand.get('links', {})
output.update({
'careers_url': links.get('careers', ''),
'privacy_url': links.get('privacy', ''),
'terms_url': links.get('terms', ''),
'contact_url': links.get('contact', ''),
'blog_url': links.get('blog', ''),
'pricing_url': links.get('pricing', '')
})
Advanced Processing
Create Brand Summary
Copy
import json
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
# Create a comprehensive brand summary
summary = f"""
Company: {brand.get('title', 'N/A')}
Domain: {brand.get('domain', 'N/A')}
Description: {brand.get('description', 'N/A')}
Slogan: {brand.get('slogan', 'N/A')}
Email: {brand.get('email', 'N/A')}
Phone: {brand.get('phone', 'N/A')}
Colors: {len(brand.get('colors', []))} colors found
Logos: {len(brand.get('logos', []))} logos found
Social Media: {len(brand.get('socials', []))} platforms
"""
# Add industry info
industries = brand.get('industries', {}).get('eic', [])
if industries:
summary += f"Primary Industry: {industries[0].get('industry', 'N/A')}\n"
# Add stock info
stock = brand.get('stock', {})
if stock.get('ticker'):
summary += f"Stock: {stock.get('ticker', '')} on {stock.get('exchange', '')}\n"
output = {
'brand_summary': summary.strip(),
'company_name': brand.get('title', ''),
'domain': brand.get('domain', ''),
'color_count': len(brand.get('colors', [])),
'logo_count': len(brand.get('logos', [])),
'social_count': len(brand.get('socials', []))
}
Validate and Clean Data
Copy
import json
import re
input_data = json.loads(input_data.get('inputData', '{}'))
brand = input_data.get('brand', {})
def clean_text(text):
"""Clean and normalize text data"""
if not text:
return ''
return re.sub(r'\s+', ' ', str(text).strip())
def validate_email(email):
"""Basic email validation"""
if not email:
return False
return '@' in email and '.' in email
def validate_url(url):
"""Basic URL validation"""
if not url:
return False
return url.startswith(('http://', 'https://'))
# Clean and validate data
output = {
'company_name': clean_text(brand.get('title', '')),
'domain': clean_text(brand.get('domain', '')),
'description': clean_text(brand.get('description', '')),
'slogan': clean_text(brand.get('slogan', '')),
'email': brand.get('email', '') if validate_email(brand.get('email', '')) else '',
'phone': clean_text(brand.get('phone', '')),
'is_nsfw': brand.get('is_nsfw', False),
'data_quality': {
'has_name': bool(brand.get('title')),
'has_domain': bool(brand.get('domain')),
'has_description': bool(brand.get('description')),
'has_email': validate_email(brand.get('email', '')),
'has_phone': bool(brand.get('phone')),
'has_colors': len(brand.get('colors', [])) > 0,
'has_logos': len(brand.get('logos', [])) > 0
}
}
Need help implementing a specific use case? Contact our team for personalized guidance.