> ## Documentation Index
> Fetch the complete documentation index at: https://wpay-feat-edp-guide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a buyer

> Add a new customer record and tie payment methods, personal information, and addresses to this customer.

You can add a buyer by calling the [`POST /buyers`][api] API. The call accepts
an optional `external_identifier` (for example the user's email, username, or a
database ID) and an optional `display_name` which will be shown in the admin
panel.

<CodeGroup>
  ```bash cURL
  curl -i -X POST "https://api.example.gr4vy.app/buyers" \
      -H "Authorization: Bearer [JWT_TOKEN]" \
      -H "Content-Type: application/json" \
      -d '{
            "display_name": "John L.",
            "external_identifier": "412231123"
          }'
  ```

  ```js Node
  const buyerRequest = new BuyerRequest();
  buyerRequest.displayName = "John L.";
  buyerRequest.externalIdentifier = "412231123";

  const buyer = await client.addBuyer(buyerRequest);
  console.log(buyer.body.display_name);
  ```
</CodeGroup>

<br />

<Note>
  A buyer can be created without any `external_identifier` and `display_name`. In
  that case, the buyer only serves as a way to link stored payment methods to a
  user ID. In this situation, you will need to keep track of the buyer's `ID` in your
  database to link it back to a user record.
</Note>

The API returns a new buyer resource.

```json POST /buyers
{
  "type": "buyer",
  "id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
  "external_identifier": "412231123",
  "display_name": "John L.",
  "created_at": "2013-07-16T19:23:00.000Z",
  "updated_at": "2013-07-16T19:23:00.000Z"
}
```

[api]: /reference/buyers/new-buyer

[transactions]: associate-transaction
