## Set account association

### cURL

```
curl --request POST \
  --url https://api.neynar.com/v2/studio/deployment/account-association \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: NEYNAR_API_DOCS' \
  --data '
{
  "account_association": {
    "header": "<string>",
    "payload": "<string>",
    "signature": "<string>"
  },
  "deployment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "fid": 3,
  "name": "<string>",
  "namespace": "<string>"
}
'
```

### Python

```
import requests

url = "https://api.neynar.com/v2/studio/deployment/account-association"

payload = {
    "account_association": {
        "header": "<string>",
        "payload": "<string>",
        "signature": "<string>"
    },
    "deployment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "fid": 3,
    "name": "<string>",
    "namespace": "<string>"
}
headers = {
    "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-api-key': 'NEYNAR_API_DOCS', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    account_association: {header: '<string>', payload: '<string>', signature: '<string>'},
    deployment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    fid: 3,
    name: '<string>',
    namespace: '<string>'
  })
};

fetch('https://api.neynar.com/v2/studio/deployment/account-association', 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/studio/deployment/account-association",
  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([
    'account_association' => [
        'header' => '<string>',
        'payload' => '<string>',
        'signature' => '<string>'
    ],
    'deployment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'fid' => 3,
    'name' => '<string>',
    'namespace' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "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;
}
?>
```

### Response Codes

- **200**
- **400**
- **404**
- **500**

### Sample Responses

```
{
  "message": "<string>",
  "success": true
}
```

```
{
  "error": "<string>"
}
```

The Miniapp Studio API is an allowlisted API and not publicly available. Contact the Neynar team for more information.

## Node.js SDK

### SDK Method: [associateDeployment](https://docs.neynar.com/nodejs-sdk/studio-apis/associateDeployment)
### Authorizations
**x-api-key**  
Type: string  
Location: header  
Default: NEYNAR_API_DOCS  
Required: Yes  
### Body
Type: application/json  
Field: account_association  
Type: object  
Required: Yes  
### Response
200 - application/json  
Field: message  
Type: string  
Required: Yes  
Field: success  
Type: boolean  
Required: Yes  
### Related topics
- [associateDeployment](https://docs.neynar.com/nodejs-sdk/studio-apis/associateDeployment)  
- [getAccountAssociation](https://docs.neynar.com/nodejs-sdk/studio-apis/getAccountAssociation)  
- [Specification](https://docs.neynar.com/miniapps/specification)  
- [Domain Migration](https://docs.neynar.com/miniapps/guides/domain-migration)  
- [Create an account](https://docs.neynar.com/farcaster/developers/guides/accounts/create-account)
