Neynar Documentation
Register Farcaster account onchain
cURL
curl --request POST \
--url https://api.neynar.com/v2/farcaster/user/register/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: NEYNAR_API_DOCS' \
--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
}
'
Python
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": "NEYNAR_API_DOCS",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'POST',
headers: {
'x-wallet-id': '<x-wallet-id>',
'x-api-key': 'NEYNAR_API_DOCS',
'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));
Response
Success responses and error responses are structured as follows:
Successful Registration Response:
{
"message": "Account registered successfully",
"transaction_hash": "0x2e276b4d014334797d9951ce2d3b7a11a4a58855cb07b3761de36785c618220a",
"user": {
"custody_address": "0x5a927ac639636e534b678e81768ca19e2c6280b7",
"username": "<string>",
"registered_at": "2023-11-07T05:31:56Z"
}
}
Error Response:
{
"message": "<string>",
"code": "<string>",
"property": "<string>",
"status": 123
}
Additional Notes
- For APIs using
developer_managedsigners, refer to the relevant documentation. - Ensure proper handling of request headers such as
x-wallet-idandx-api-keyfor authorization.