Register Farcaster account onchain
curl --request POST \
--url https://api.neynar.com/v2/farcaster/user/register/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-wallet-id: <x-wallet-id>' \
--data '
{
"registration": {
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"deadline": 1715190000,
"recovery_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"signature": "<string>"
},
"idem": "<string>",
"pre_registration_calls": [
{
"data": "<string>",
"target": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"allow_failure": false,
"value": 0
}
],
"signers": [
{
"deadline": 1715190000,
"metadata": "<string>",
"public_key": "0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22",
"signature": "<string>",
"key_type": 1,
"metadata_type": 1
}
],
"storage_units": 2
}
'import requests
url = "https://api.neynar.com/v2/farcaster/user/register/"
payload = {
"registration": {
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"deadline": 1715190000,
"recovery_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"signature": "<string>"
},
"idem": "<string>",
"pre_registration_calls": [
{
"data": "<string>",
"target": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"allow_failure": False,
"value": 0
}
],
"signers": [
{
"deadline": 1715190000,
"metadata": "<string>",
"public_key": "0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22",
"signature": "<string>",
"key_type": 1,
"metadata_type": 1
}
],
"storage_units": 2
}
headers = {
"x-wallet-id": "<x-wallet-id>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-wallet-id': '<x-wallet-id>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
registration: {
custody_address: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
deadline: 1715190000,
recovery_address: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
signature: '<string>'
},
idem: '<string>',
pre_registration_calls: [
{
data: '<string>',
target: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
allow_failure: false,
value: 0
}
],
signers: [
{
deadline: 1715190000,
metadata: '<string>',
public_key: '0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22',
signature: '<string>',
key_type: 1,
metadata_type: 1
}
],
storage_units: 2
})
};
fetch('https://api.neynar.com/v2/farcaster/user/register/', 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/register/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'registration' => [
'custody_address' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'deadline' => 1715190000,
'recovery_address' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'signature' => '<string>'
],
'idem' => '<string>',
'pre_registration_calls' => [
[
'data' => '<string>',
'target' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'allow_failure' => false,
'value' => 0
]
],
'signers' => [
[
'deadline' => 1715190000,
'metadata' => '<string>',
'public_key' => '0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22',
'signature' => '<string>',
'key_type' => 1,
'metadata_type' => 1
]
],
'storage_units' => 2
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-wallet-id: <x-wallet-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.neynar.com/v2/farcaster/user/register/"
payload := strings.NewReader("{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-wallet-id", "<x-wallet-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.neynar.com/v2/farcaster/user/register/")
.header("x-wallet-id", "<x-wallet-id>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neynar.com/v2/farcaster/user/register/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-wallet-id"] = '<x-wallet-id>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}"
response = http.request(request)
puts response.read_body{
"message": "Account registered successfully",
"transaction_hash": "0x2e276b4d014334797d9951ce2d3b7a11a4a58855cb07b3761de36785c618220a",
"user": {
"auth_addresses": [
{
"address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"app": {
"fid": 3,
"object": "user_dehydrated",
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"display_name": "<string>",
"pfp_url": "<string>",
"score": 123,
"username": "<string>"
}
}
],
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"fid": 3,
"follower_count": 123,
"following_count": 123,
"object": "user",
"profile": {
"bio": {
"text": "<string>",
"mentioned_channels": [
{
"id": "<string>",
"name": "<string>",
"object": "channel_dehydrated",
"image_url": "<string>",
"viewer_context": {
"following": true
}
}
],
"mentioned_channels_ranges": [
{
"end": 1,
"start": 1
}
],
"mentioned_profiles": [
{
"fid": 3,
"object": "user_dehydrated",
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"display_name": "<string>",
"pfp_url": "<string>",
"score": 123,
"username": "<string>"
}
],
"mentioned_profiles_ranges": [
{
"end": 1,
"start": 1
}
]
},
"banner": {
"url": "<string>"
},
"live_at": {
"is_live": true,
"updated_at": "2023-11-07T05:31:56Z",
"url": "<string>"
},
"location": {
"latitude": 0,
"longitude": 0,
"address": {
"city": "<string>",
"country": "<string>",
"country_code": "<string>",
"state": "<string>",
"state_code": "<string>"
},
"radius": 1
}
},
"registered_at": "2023-11-07T05:31:56Z",
"username": "<string>",
"verifications": [
"0x5a927ac639636e534b678e81768ca19e2c6280b7"
],
"verified_accounts": [
{
"username": "<string>"
}
],
"verified_addresses": {
"eth_addresses": [
"0x5a927ac639636e534b678e81768ca19e2c6280b7"
],
"primary": {
"eth_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"sol_address": "<string>"
},
"sol_addresses": [
"<string>"
]
},
"display_name": "<string>",
"experimental": {
"neynar_user_score": 123,
"deprecation_notice": "<string>"
},
"pfp_url": "<string>",
"pro": {
"expires_at": "2023-11-07T05:31:56Z",
"subscribed_at": "2023-11-07T05:31:56Z"
},
"score": 123,
"viewer_context": {
"blocked_by": true,
"blocking": true,
"followed_by": true,
"following": true
}
}
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}Onchain
Register Farcaster account onchain
Register a new farcaster account onchain. Optionally you can pass in signers to register a new account and create multiple signers in a single transaction. Requires x-wallet-id header.
POST
/
v2
/
farcaster
/
user
/
register
/
Register Farcaster account onchain
curl --request POST \
--url https://api.neynar.com/v2/farcaster/user/register/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-wallet-id: <x-wallet-id>' \
--data '
{
"registration": {
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"deadline": 1715190000,
"recovery_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"signature": "<string>"
},
"idem": "<string>",
"pre_registration_calls": [
{
"data": "<string>",
"target": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"allow_failure": false,
"value": 0
}
],
"signers": [
{
"deadline": 1715190000,
"metadata": "<string>",
"public_key": "0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22",
"signature": "<string>",
"key_type": 1,
"metadata_type": 1
}
],
"storage_units": 2
}
'import requests
url = "https://api.neynar.com/v2/farcaster/user/register/"
payload = {
"registration": {
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"deadline": 1715190000,
"recovery_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"signature": "<string>"
},
"idem": "<string>",
"pre_registration_calls": [
{
"data": "<string>",
"target": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"allow_failure": False,
"value": 0
}
],
"signers": [
{
"deadline": 1715190000,
"metadata": "<string>",
"public_key": "0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22",
"signature": "<string>",
"key_type": 1,
"metadata_type": 1
}
],
"storage_units": 2
}
headers = {
"x-wallet-id": "<x-wallet-id>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-wallet-id': '<x-wallet-id>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
registration: {
custody_address: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
deadline: 1715190000,
recovery_address: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
signature: '<string>'
},
idem: '<string>',
pre_registration_calls: [
{
data: '<string>',
target: '0x5a927ac639636e534b678e81768ca19e2c6280b7',
allow_failure: false,
value: 0
}
],
signers: [
{
deadline: 1715190000,
metadata: '<string>',
public_key: '0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22',
signature: '<string>',
key_type: 1,
metadata_type: 1
}
],
storage_units: 2
})
};
fetch('https://api.neynar.com/v2/farcaster/user/register/', 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/register/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'registration' => [
'custody_address' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'deadline' => 1715190000,
'recovery_address' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'signature' => '<string>'
],
'idem' => '<string>',
'pre_registration_calls' => [
[
'data' => '<string>',
'target' => '0x5a927ac639636e534b678e81768ca19e2c6280b7',
'allow_failure' => false,
'value' => 0
]
],
'signers' => [
[
'deadline' => 1715190000,
'metadata' => '<string>',
'public_key' => '0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22',
'signature' => '<string>',
'key_type' => 1,
'metadata_type' => 1
]
],
'storage_units' => 2
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-wallet-id: <x-wallet-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.neynar.com/v2/farcaster/user/register/"
payload := strings.NewReader("{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-wallet-id", "<x-wallet-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.neynar.com/v2/farcaster/user/register/")
.header("x-wallet-id", "<x-wallet-id>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neynar.com/v2/farcaster/user/register/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-wallet-id"] = '<x-wallet-id>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"registration\": {\n \"custody_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"deadline\": 1715190000,\n \"recovery_address\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"signature\": \"<string>\"\n },\n \"idem\": \"<string>\",\n \"pre_registration_calls\": [\n {\n \"data\": \"<string>\",\n \"target\": \"0x5a927ac639636e534b678e81768ca19e2c6280b7\",\n \"allow_failure\": false,\n \"value\": 0\n }\n ],\n \"signers\": [\n {\n \"deadline\": 1715190000,\n \"metadata\": \"<string>\",\n \"public_key\": \"0x3daa8f99c5f760688a3c9f95716ed93dee5ed5d7722d776b7c4deac957755f22\",\n \"signature\": \"<string>\",\n \"key_type\": 1,\n \"metadata_type\": 1\n }\n ],\n \"storage_units\": 2\n}"
response = http.request(request)
puts response.read_body{
"message": "Account registered successfully",
"transaction_hash": "0x2e276b4d014334797d9951ce2d3b7a11a4a58855cb07b3761de36785c618220a",
"user": {
"auth_addresses": [
{
"address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"app": {
"fid": 3,
"object": "user_dehydrated",
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"display_name": "<string>",
"pfp_url": "<string>",
"score": 123,
"username": "<string>"
}
}
],
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"fid": 3,
"follower_count": 123,
"following_count": 123,
"object": "user",
"profile": {
"bio": {
"text": "<string>",
"mentioned_channels": [
{
"id": "<string>",
"name": "<string>",
"object": "channel_dehydrated",
"image_url": "<string>",
"viewer_context": {
"following": true
}
}
],
"mentioned_channels_ranges": [
{
"end": 1,
"start": 1
}
],
"mentioned_profiles": [
{
"fid": 3,
"object": "user_dehydrated",
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"display_name": "<string>",
"pfp_url": "<string>",
"score": 123,
"username": "<string>"
}
],
"mentioned_profiles_ranges": [
{
"end": 1,
"start": 1
}
]
},
"banner": {
"url": "<string>"
},
"live_at": {
"is_live": true,
"updated_at": "2023-11-07T05:31:56Z",
"url": "<string>"
},
"location": {
"latitude": 0,
"longitude": 0,
"address": {
"city": "<string>",
"country": "<string>",
"country_code": "<string>",
"state": "<string>",
"state_code": "<string>"
},
"radius": 1
}
},
"registered_at": "2023-11-07T05:31:56Z",
"username": "<string>",
"verifications": [
"0x5a927ac639636e534b678e81768ca19e2c6280b7"
],
"verified_accounts": [
{
"username": "<string>"
}
],
"verified_addresses": {
"eth_addresses": [
"0x5a927ac639636e534b678e81768ca19e2c6280b7"
],
"primary": {
"eth_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"sol_address": "<string>"
},
"sol_addresses": [
"<string>"
]
},
"display_name": "<string>",
"experimental": {
"neynar_user_score": 123,
"deprecation_notice": "<string>"
},
"pfp_url": "<string>",
"pro": {
"expires_at": "2023-11-07T05:31:56Z",
"subscribed_at": "2023-11-07T05:31:56Z"
},
"score": 123,
"viewer_context": {
"blocked_by": true,
"blocking": true,
"followed_by": true,
"following": true
}
}
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}Node.js SDK
π SDK Method: registerAccountOnchain Use this API endpoint with the Neynar Node.js SDK for typed responses and better developer experience.Authorizations
API key to authorize requests
Headers
Wallet ID to use for transactions
Body
application/json
Show child attributes
Show child attributes
An Idempotency key is a unique identifier for the request. Note:
- Pre-registration calls must be idempotent when using idempotency keys.
- This is used to prevent duplicate requests. Use the same idem key on retry attempts.
- This should be a unique identifier for each request.
- Recommended format is a 16-character string generated by the developer at the time of making this request.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required range:
x >= 0Example:
2
Was this page helpful?
βI