## Best friends

### cURL

```bash
curl --request GET \
  --url 'https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3' \
  --header 'x-api-key: NEYNAR_API_DOCS'
```

```python
import requests

url = "https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3"

headers = {"x-api-key": "NEYNAR_API_DOCS"}

response = requests.get(url, headers=headers)

print(response.text)
```

```javascript
const options = {method: 'GET', headers: {'x-api-key': 'NEYNAR_API_DOCS'}};

fetch('https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3",\
  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: NEYNAR_API_DOCS"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-api-key", "NEYNAR_API_DOCS")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

```java
HttpResponse<String> response = Unirest.get("https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3")
  .header("x-api-key", "NEYNAR_API_DOCS")
  .asString();
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.neynar.com/v2/farcaster/user/best_friends/?limit=3")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = 'NEYNAR_API_DOCS'

response = http.request(request)
puts response.read_body
```

### HTTP Status Codes

- **200**: Success
- **400**: Bad Request
- **500**: Internal Server Error

### Example JSON Responses

#### Successful Response
```json
{
  "users": [\
    {\
      "fid": 123,\
      "mutual_affinity_score": 123,\
      "username": "<string>"\
    }\
  ],
  "next": {
    "cursor": "<string>"
  }
}
```

#### Error Response
```json
{
  "code": "InvalidField",
  "errors": [\
    {\
      "code": "<string>",\
      "expected": "<string>",\
      "message": "<string>",\
      "path": [\
        "<string>"\
      ],\
      "received": "<string>"
    }\
  ],
  "message": "Invalid query parameters"
}
```

```json
{
  "message": "<string>",
  "code": "<string>",
  "property": "<string>",
  "status": 123
}
```

### Authorizations
- **x-api-key**: string, header, required
  - Default: NEYNAR_API_DOCS
  - API key to authorize requests

### Query Parameters
- **fid**: integer, required
  - The FID of the user
  - Required range: `x >= 1`
- **limit**: integer
  - Default: 3
  - Number of results to fetch
  - Required range: `1 <= x <= 100`
- **cursor**: string
  - Pagination cursor

### Response Structure
- **users**: object[] (required)
  - Showchild attributes
- **next**: NextCursor · object
  - Returns next cursor
