5-Minute Quickstart
Get started with Cohera in just a few minutes. This guide will walk you through setting up your environment, obtaining an API key, and making your first API call.
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have:
- A Cohera account (sign up for free)
- Python 3.8+ or Node.js 18+ installed
- A terminal or command prompt
Step 1: Get Your API Key
Section titled “Step 1: Get Your API Key”- Log in to your Cohera Dashboard
- Navigate to Settings > API Keys
- Click Create New Key
- Give your key a descriptive name (e.g., “Development”)
- Copy the key and store it securely
Step 2: Install the SDK
Section titled “Step 2: Install the SDK”pip install coheranpm install @cohera/sdknpm install -g @cohera/cliStep 3: Configure Authentication
Section titled “Step 3: Configure Authentication”import osfrom cohera import Cohera
# Option 1: Environment variable (recommended)os.environ["COHERA_API_KEY"] = "your-api-key"client = Cohera()
# Option 2: Direct initializationclient = Cohera(api_key="your-api-key")import { Cohera } from '@cohera/sdk';
// Option 1: Environment variable (recommended)process.env.COHERA_API_KEY = 'your-api-key';const client = new Cohera();
// Option 2: Direct initializationconst client = new Cohera({ apiKey: 'your-api-key' });# Configure the CLI with your API keycohera config set api-key your-api-key
# Verify the configurationcohera config get api-keyStep 4: Make Your First API Call
Section titled “Step 4: Make Your First API Call”Let’s list all certificates in your organization:
from cohera import Cohera
client = Cohera()
# List all certificatescertificates = client.certificates.list()
for cert in certificates: print(f"Certificate: {cert.name}") print(f" Supplier: {cert.supplier.name}") print(f" Expires: {cert.expiry_date}") print()import { Cohera } from '@cohera/sdk';
const client = new Cohera();
// List all certificatesconst certificates = await client.certificates.list();
for (const cert of certificates) { console.log(`Certificate: ${cert.name}`); console.log(` Supplier: ${cert.supplier.name}`); console.log(` Expires: ${cert.expiryDate}`); console.log();}# List all certificatescohera certificates list
# Get details of a specific certificatecohera certificates get cert_abc123
# Export certificates to JSONcohera certificates list --format json > certificates.jsonStep 5: Explore the Ontology
Section titled “Step 5: Explore the Ontology”Cohera’s power comes from its ontology - the relationships between objects. Let’s explore:
# Get a certificate with its relationshipscert = client.certificates.get("cert_abc123", include=["supplier", "components", "products"])
# Access related objectsprint(f"Supplier: {cert.supplier.name}")print(f"Components: {len(cert.components)}")
# Find all products affected by this certificatefor product in cert.products: print(f" - {product.name} ({product.sku})")// Get a certificate with its relationshipsconst cert = await client.certificates.get('cert_abc123', { include: ['supplier', 'components', 'products']});
// Access related objectsconsole.log(`Supplier: ${cert.supplier.name}`);console.log(`Components: ${cert.components.length}`);
// Find all products affected by this certificatefor (const product of cert.products) { console.log(` - ${product.name} (${product.sku})`);}Next Steps
Section titled “Next Steps”Congratulations! You’ve made your first API calls to Cohera. Here’s what to explore next:
- Authentication - Learn about OAuth2 and JWT tokens
- Python SDK - Deep dive into the Python SDK
- TypeScript SDK - Deep dive into the TypeScript SDK
- API Reference - Complete API documentation
Need Help?
Section titled “Need Help?”- Join our Discord community
- Check out GitHub Discussions
- Email us at developers@cohera.io