Phen AI LogoPhen AI

Phen AI Documentation

Everything you need to integrate and build with our powerful AI solutions

API Reference

Our comprehensive API allows you to access the full power of Phen AI from any application.

API Response Example
{
  "status": "ok",
  "version": "1.0.5",
  "message": "API is operational"
}

SDK & Libraries

Integrate with Phen AI using our official client libraries

Python

Our official Python client for seamless integration with the Phen AI API.

pip install phenai-python

JavaScript

Official JavaScript/Node.js SDK for integrating with Phen AI.

npm install @phenai/sdk

Java

Java SDK for enterprise applications that need to integrate with Phen AI.

maven: com.phenai:sdk:1.0.2

Ruby

Ruby gem for easy integration with the Phen AI platform.

gem install phenai-ruby

Code Examples

Explore common integration patterns and use cases

Webhook Event Handler

Setting up a webhook handler to receive events from Phen AI

Node.js (Express)
const express = require('express');
const crypto = require('crypto');
const app = express();

// Middleware to parse JSON bodies
app.use(express.json());

// Webhook endpoint
app.post('/webhook', (req, res) => {
  const signature = req.headers['x-phenai-signature'];
  const payload = req.body;
  
  // Verify webhook signature
  const isValid = verifySignature(payload, signature);
  
  if (isValid) {
    // Process the webhook event
    console.log('Received valid webhook:', payload);
    res.status(200).send('Webhook received');
  } else {
    res.status(401).send('Invalid signature');
  }
});

app.listen(3000, () => {
  console.log('Webhook server running on port 3000');
});
AuthenticationView more examples

Text Analysis with Error Handling

Analyzing text content with proper error handling

JavaScript
import { PhenAI } from '@phenai/sdk';

const phenai = new PhenAI('your_api_key');

async function analyzeCustomerFeedback(text) {
  try {
    const analysis = await phenai.textAnalysis.analyze({
      text: text,
      features: ['sentiment', 'entities', 'keywords'],
      language: 'en'
    });
    
    console.log('Sentiment:', analysis.sentiment);
    console.log('Entities:', analysis.entities);
    console.log('Keywords:', analysis.keywords);
    
    return analysis;
  } catch (error) {
    console.error('Error analyzing text:', error);
    
    // Handle specific error types
    if (error.code === 'rate_limit_exceeded') {
      console.log('Rate limit exceeded, retrying in 60s');
      // Implement retry logic
    }
    
    throw error;
  }
}

Tutorials & Guides

Step-by-step instructions to help you get the most out of Phen AI

Beginner15 min

Getting Started with Phen AI

Learn the fundamentals of the Phen AI platform and how to set up your first project.

Intermediate30 min

Building a Prediction Model

Create your first prediction model using historical data and deploy it to production.

Intermediate45 min

Integrating with Your Application

Learn how to integrate Phen AI APIs with your existing web or mobile application.

Advanced60 min

Advanced Text Analysis

Explore advanced text analysis features including entity extraction and sentiment analysis.

Intermediate30 min

Webhook Implementation

Set up webhooks to receive real-time updates from your Phen AI applications.

Beginner20 min

API Authentication Best Practices

Learn secure ways to handle API authentication in different environments.