feeds.create()
Create a new feed for content distribution.
Signature
feeds.create(input: CreateFeedInput): Promise<Feed>Parameters
input
- Type:
CreateFeedInput
interface CreateFeedInput {
name: string; // Required
description?: string;
tags?: string[];
category_id?: string; // UUID
image_url?: string;
}Returns
- Type:
Promise<Feed>
interface Feed {
id: string;
owner_id: string;
owner_wallet_address: string;
category_id?: string;
name: string;
description?: string;
image_cid?: string; // IPFS CID of the image (if provided)
is_active: boolean;
total_entries: number;
total_purchases: number;
total_revenue: string;
tags: string[] | null;
created_at: number;
updated_at: number;
}Usage
Basic Example
const feed = await grapevine.feeds.create({
name: 'My Content Feed'
});
console.log('Feed ID:', feed.id);With All Options
const feed = await grapevine.feeds.create({
name: 'Tech Blog',
description: 'Latest tech articles and tutorials',
tags: ['tech', 'programming', 'tutorial'],
category_id: '123e4567-e89b-12d3-a456-426614174000',
image_url: 'https://example.com/cover.jpg'
});With Categories
// Get categories first
const categories = await grapevine.categories.getAll();
const techCategory = categories.find(c => c.name === 'Technology');
const feed = await grapevine.feeds.create({
name: 'Tech News',
category_id: techCategory?.id,
tags: ['tech', 'news']
});Behind the Scenes
This method:
- Validates input parameters
- Gets authentication headers (nonce + signature)
- Makes POST request to
/v1/feeds - Handles 402 payment automatically
- Creates x402 payment if needed
- Retries with payment header
- Returns the created feed
Error Handling
try {
const feed = await grapevine.feeds.create({
name: 'Test Feed'
});
} catch (error) {
if (error.message.includes('402')) {
console.error('Payment failed');
} else if (error.message.includes('403')) {
console.error('Maximum feed limit reached');
} else {
console.error('Error:', error.message);
}
}Notes
- Authentication: Required - private key must be provided in client config
- Payment: Requires x402 micropayment (handled automatically)
- Feed Limit: Maximum 10 feeds per wallet
- Private IPFS Storage: Images are stored on Private IPFS, returns
image_cid
Related
- feeds.list() - List your feeds
- feeds.get() - Get feed details
- entries.create() - Add content to feed