Best friends
curl --request GET \
--url https://api.neynar.com/v2/farcaster/user/best_friends/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.neynar.com/v2/farcaster/user/best_friends/"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.neynar.com/v2/farcaster/user/best_friends/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.neynar.com/v2/farcaster/user/best_friends/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.neynar.com/v2/farcaster/user/best_friends/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.neynar.com/v2/farcaster/user/best_friends/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neynar.com/v2/farcaster/user/best_friends/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"users": [
{
"fid": 123,
"mutual_affinity_score": 123,
"username": "<string>"
}
],
"next": {
"cursor": "<string>"
}
}{
"code": "InvalidField",
"errors": [
{
"code": "<string>",
"expected": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"received": "<string>"
}
],
"message": "Invalid query parameters"
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}Follow
Best friends
Returns the best friends of a user ranked by mutual affinity score based on interactions with each other.
GET
/
v2
/
farcaster
/
user
/
best_friends
/
Best friends
curl --request GET \
--url https://api.neynar.com/v2/farcaster/user/best_friends/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.neynar.com/v2/farcaster/user/best_friends/"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.neynar.com/v2/farcaster/user/best_friends/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.neynar.com/v2/farcaster/user/best_friends/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.neynar.com/v2/farcaster/user/best_friends/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.neynar.com/v2/farcaster/user/best_friends/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neynar.com/v2/farcaster/user/best_friends/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"users": [
{
"fid": 123,
"mutual_affinity_score": 123,
"username": "<string>"
}
],
"next": {
"cursor": "<string>"
}
}{
"code": "InvalidField",
"errors": [
{
"code": "<string>",
"expected": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"received": "<string>"
}
],
"message": "Invalid query parameters"
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}Authorizations
API key to authorize requests
Query Parameters
The FID of the user
Required range:
x >= 1Number of results to fetch
Required range:
1 <= x <= 100Example:
5
Pagination cursor
Related topics
getUserBestFriendsHow to Build Viral Mini AppsCommon UX Mistakes and Launch Strategies for Mini AppsHapticsCreate and Manage Miniapp Studio DeploymentsWas this page helpful?
⌘I