Getting Started - Your First Feed
First of all, welcome to 'mbd! 🎉 Here you'll get access to the most powerful real-time AI models to power and level up your web3 social APPs through simple API access. Straight out of the box with a few lines of code, you get the power of world-class recommendation AI models, through which you can provide fun and hyper-personalized service to your users.
Getting started with 'mbd is as easy as:
- Create an account
- Copy API Key
- Call an 'mbd API
1. Create an 'mbd account
If you don't already have one, you will need to create an 'mbd account. You can do so by visiting the 'mbd console and just signing up.
2. Copy API Key
Once you're in, you will notice that an API key is already automatically created for you. Take note of it, or click on the "reveal" (eye) icon and then copy the key. You will need the API key to call our APIs.
3. Call an 'mbd API
Now you're ready to make your first 'mbd API call! We will start with /for-you, the API that is very much personalized to the user viewing the feed (specified by user_id
in the API call).
Bare minimum version
To call the API in the simplest form, you need to:
- specify your API key in the headers with
x-api-key
, and - pass in the viewer
user_id
(the Farcaster fid) orwallet_address
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'x-api-key': 'YOUR-API-KEY'
},
body: JSON.stringify({
user_id: '3'
})
};
fetch('https://api.mbd.xyz/v1/farcaster/casts/feed/for-you', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
This gives you a result similar to the following:
{
"status_code": 200,
"body": [
{
"score": 0.001231,
"source_feed": "main",
"item_id": "0xc7525f91f7de1e27ed1b101cac98ea20182d2618"
},
{
"score": 0.000885,
"source_feed": "main",
"item_id": "0xbdf50a06145f452d3c9b1c94c0c1f276a5137f10"
},
{
"score": 0.0008739,
"source_feed": "main",
"item_id": "0x5cbfbc3e0553b5e0be1f2b2b0df477248f605aea"
},
{
"score": 0.0008736,
"source_feed": "main",
"item_id": "0x5fc88dbff03f8ad368cfb29c7de6ac2d249f32b1"
},
{
"score": 0.0007845,
"source_feed": "main",
"item_id": "0x54fa7270b2f5ad09ed95878be6cc3ed16818cee0"
},
// more results
}
Explanation:
item_id
: This is the Farcaster cast hash, which you can use in other APIs that accept item_id
as parameters
score
: This is a relative score indicating confidence of relevance to the user. The score of all recommended items add to 1
source_feed
: This indicates the "source" of where this recommended item. In this simple API call, all items belong to the "main" feed. The feed will include items with different "source_feed" when promotion feeds or promotion items are used. See our [feed features](https://docs.mbd.xyz/docs/our-features-explained#promotions)
explanation.
To render the feed
item_id
is probably not enough for you to build a useful APP. In order to render the key information of a cast in the feed, call the API with return_metadata: true
. This option returns enough information of each cast for you to render the cast in a feed.
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'x-api-key': 'mbd-09eeb0da241bd441a9fd36326d965463951ae4136b9d9457412ae95f66163954'
},
body: JSON.stringify({
user_id: '3',
return_metadata: true
})
};
fetch('https://api.mbd.xyz/v1/farcaster/casts/feed/for-you', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Now you should get a response like this:
{
"status_code": 200,
"body": [
{
"score": 0.001231,
"source_feed": "main",
"item_id": "0xc7525f91f7de1e27ed1b101cac98ea20182d2618",
"metadata": {
"text": "ok i think i just stopped posting here lol was funny for the streak of a different author daily rip i can't promise i will remember you tbh",
"embed_items": [
"https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/e349139c-6d16-42c6-4f51-b0479d310d00/original"
],
"timestamp": 1730748361,
"root_parent_hash": "0xc7525f91f7de1e27ed1b101cac98ea20182d2618",
"parent_hash": null,
"root_parent_url": "chain://eip155:1/erc721:0x1538c5ddbb073638b7cd1ae41ec2d9f9a4c24a7e",
"mentioned_profiles": [
9152
],
"ai_labels": {
"topics": [
"diaries_daily_life"
],
"sentiment": [
"neutral"
],
"emotion": [
"joy"
],
"moderation": [],
"web3_topics": []
},
"author": {
"user_id": 662851,
"username": "littlesilver",
"display_name": "Bartholomew Littlesilver",
"pfp_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/cf8cd550-4b72-4ce3-d262-5d99a0040900/original"
}
}
},
{
"score": 0.000885,
"source_feed": "main",
"item_id": "0xbdf50a06145f452d3c9b1c94c0c1f276a5137f10",
"metadata": {
"text": "Eventually meme even for my CIS friends",
"embed_items": [
"https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/c7adb8ed-7d79-4a74-7e2d-e313aa954700/original"
],
"timestamp": 1730630136,
"root_parent_hash": "0xbdf50a06145f452d3c9b1c94c0c1f276a5137f10",
"parent_hash": null,
"root_parent_url": "https://warpcast.com/~/channel/chatbfg",
"mentioned_profiles": [],
"ai_labels": {
"topics": [
"diaries_daily_life"
],
"sentiment": [
"neutral"
],
"emotion": [
"joy"
],
"moderation": [],
"web3_topics": []
},
"author": {
"user_id": 351855,
"username": "frissonchain.eth",
"display_name": "frisson 🎩🔵⚡️",
"pfp_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/3aca4074-301c-49ee-793a-b755f5f58600/original"
}
}
},
{
"score": 0.0008739,
"source_feed": "main",
"item_id": "0x5cbfbc3e0553b5e0be1f2b2b0df477248f605aea",
"metadata": {
"text": "it’s funny cause now every time I see an anoncast i’m like “is that ? nah it couldn’t be.. right???”",
"embed_items": [],
"timestamp": 1732199657,
"root_parent_hash": "0x5cbfbc3e0553b5e0be1f2b2b0df477248f605aea",
"parent_hash": null,
"root_parent_url": "https://warpcast.com/~/channel/anoncast",
"mentioned_profiles": [
5650
],
"ai_labels": {
"topics": [],
"sentiment": [
"neutral"
],
"emotion": [
"joy"
],
"moderation": [],
"web3_topics": []
},
"author": {
"user_id": 366795,
"username": "thxpikachu",
"display_name": "pikachu⚡️",
"pfp_url": "https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/f8f04f3c-e56d-4759-25db-3c523beda400/original"
}
}
},
// more casts with metadata
}
That's it! This with this, you can create a personalized feed for a user, and render the feed in your creative style!
Of course, this is just the tip of the iceberg of what the APIs have to offer. Make sure you check out the following to get the full power of 'mbd!
Updated 5 days ago