Neynar Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
This tutorial uses the Neynar Go SDK
This SDK is in beta and may change in the future. Please let us know if you encounter any issues or have suggestions for improvement.
Prerequisites
- Install Go
- Get your Neynar API key from neynar.com
Project Setup
Initialize Project Directory
Shell
mkdir get-started-with-neynar-go-sdk
cd get-started-with-neynar-go-sdk
go mod init getting_started
Add Neynar Go SDK as a dependency
Shell
go get github.com/neynarxyz/go-sdk/generated/rust_sdk
Implementation: Look up a user by their verified address
Replace the contents of main.go with your Go code using the Neynar Go SDK.
main.go
package getting_started
import (
"context"
"fmt"
openapiclient "github.com/neynarxyz/go-sdk/generated/neynar_sdk"
)
func main() {
configuration := openapiclient.NewConfiguration()
configuration.AddDefaultHeader("x-api-key", "NEYNAR_API_DOCS")
apiClient := openapiclient.NewAPIClient(configuration)
request := apiClient.UserAPI.
FetchBulkUsersByEthOrSolAddress(context.Background()).
Addresses("0xBFc7CAE0Fad9B346270Ae8fde24827D2D779eF07").
AddressTypes([]openapiclient.BulkUserAddressType{openapiclient.AllowedBulkUserAddressTypeEnumValues[1]})
resp, httpRes, err := request.Execute()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
defer httpRes.Body.Close()
fmt.Printf("Users: %+v\n", resp)
}
Running the project
Shell
go run main.go
Result
You should see a response similar to this (formatted for readability):
Shell
Users: [{\
fid: 20603,\
username: "topocount.eth",\
display_name: "Topocount",\
// ...other fields...\
}]
Congratulations! You successfully set up the Neynar Go SDK and used it to look up a user by their address!
Ready to start building?
Get your subscription at neynar.com and reach out to us on Slack with any questions!