Learn how to use the Vendors API to create vendors for a Square seller.
Vendors API

Create Vendors for a Square Seller Beta release
This is pre-release documentation for an API in public beta and is subject to change.

To add a vendor to a seller account, create a Vendor object in the seller account by calling the CreateVendor or BulkCreateVendors endpoint. The CreateVendor endpoint creates a single vendor at a time, while BulkCreateVendors creates multiple vendors at a time.

When creating a vendor, you must specify at a minimum the name and status. Optionally, you can specify an address for the vendor or one or more contact persons for the vendor. You can also assign the vendor an account number or add a custom note about the vendor.

Add a vendor with the most basic information Permalink Get a link to this section

To create a vendor with the most basic information, call the CreateVendor endpoint, specifying the vendor's name and status and, optionally, assigning an account ID.

With this basic operation, the vendor's address or contacts are not present in the resulting Vendor object, but can be added later by calling the UpdateVendor endpoint.

Request: Create a vendor without an address or contacts Permalink Get a link to this section

The following example creates a vendor with the most basic information, including the vendor's name and status:

Create Vendor
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
curl https://connect.squareupsandbox.com/v2/vendors/create \
  -X POST \
  -H 'Square-Version: 2022-05-12' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "{UNIQUE_ID}",
    "vendor": {
      "account_number": "12345",
      "name": "Vendor 1",
      "status": "ACTIVE"
    }
  }'

The vendor name must be unique across the seller account. If the name attribute value is the same as an existing vendor name, you get a 400 BAD_REQUEST response stating that the name attribute value is not unique.

Response: Create a vendor without an address or contacts Permalink Get a link to this section

The successful response to the simple vendor creation request contains a payload similar to the following:

Create a vendor with an address and contacts Permalink Get a link to this section

If an address is known or contacts are known, you can specify them in the input when calling CreateVendor. The following example shows how to create a vendor while specifying the vendor's address and a contact.

Request: Create a vendor with an address and contacts Permalink Get a link to this section

Create Vendor
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
curl https://connect.squareupsandbox.com/v2/vendors/create \
  -X POST \
  -H 'Square-Version: 2022-05-12' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "{UNIQUE_KEY}",
    "vendor": {
      "account_number": "123456",
      "name": "Vendor 123",
      "status": "ACTIVE",
      "address": {
        "address_line_1": "505 Electric Ave",
        "address_line_2": "Suite 600",
        "locality": "New York",
        "administrative_district_level_1": "NY",
        "postal_code": "10003",
        "country": "US"
      },
      "contacts": [
        {
          "name": "Joe Burrow",
          "email_address": "joe@joesfreshseafood.com",
          "phone_number": "1-212-555-4250",
          "ordinal": 0
        }
      ]
    }
  }'

For the vendor's address, you use address_line_1 or address_line_2 for the vendor's street address, locality for the city, and administrative_district_level_1 for the state or province.

A vendor can have more than one contact. In the contacts list of a vendor, each contact entry must have an ordinal value. You can use this ordinal value to sort contacts.

Response: Create a vendor with an address and contacts Permalink Get a link to this section

The successful response to the previous request contains a payload similar to the following:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
{
    "vendor": {
        "id": "L2CSGWWIGRQZIPLQ",
        "created_at": "2021-12-16T00:11:05.522Z",
        "updated_at": "2021-12-16T00:11:05.522Z",
        "name": "Vendor 123",
        "address": {
            "address_line_1": "505 Electric Ave",
            "address_line_2": "Suite 600",
            "locality": "New York",
            "administrative_district_level_1": "NY",
            "postal_code": "10003",
            "country": "US"
        },
        "contacts": [
            {
                "id": "JXRHMI4RL47YB7OW",
                "name": "Joe Burrow",
                "email_address": "joe@joesfreshseafood.com",
                "phone_number": "1-212-555-4250",
                "ordinal": 0
            }
        ],
        "account_number": "123456",
        "version": 1,
        "status": "ACTIVE"
    }
}

Create multiple vendors at once Permalink Get a link to this section

To create multiple vendors at once, call the BulkCreateVendors endpoint. The vendors input parameter contains the list of the to-be-created vendors. This parameter is a map of Vendor objects. A key of the map is an idempotency key used to ensure that the object is not duplicated no matter how many times the object creation is attempted.

If a specified vendor object shares the name with another vendor object, the specified vendor object is not created. Other specified vendor objects can be successfully created in a call to BulkCreateVendors, as long as their names are unique among themselves and other existing vendor objects. Bulk operations differ from batch operations in that the former permits partial successes, whereas the latter does not.

You can use BulkCreateVendors to add a single vendor by making the vendors map contain a single idempotency_key-object pair.

Request: Create two vendors at once Permalink Get a link to this section

Bulk Create Vendors
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
curl https://connect.squareupsandbox.com/v2/vendors/bulk-create \
  -X POST \
  -H 'Square-Version: 2022-05-12' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "vendors": {
      "0e5785ba-8371-48ed-8317-909edc33a08f": {
        "name": "Vendor A",
        "address": {
          "address_line_1": "101 Main Street",
          "address_line_2": "Suite 1",
          "locality": "City",
          "administrative_district_level_1": "State",
          "postal_code": "10003",
          "country": "US"
        },
        "contacts": [
          {
            "name": "Vendor A'\''s Contact",
            "email_address": "joe@acme.com",
            "phone_number": "1-212-555-4250",
            "ordinal": 0
          }
        ],
        "account_number": "4025391",
        "note": "a vendor",
        "status": "ACTIVE"
      },
      "0432162f-e3d4-4627-ad5f-f60794f220c3": {
        "name": "Vendor 2A",
        "status": "ACTIVE",
        "contacts": [
          {
            "name": "Vendor B'\''s Contact",
            "email_address": "annie@acme.com",
            "phone_number": "1-212-555-4251",
            "ordinal": 1
          }
        ]
      }
    }
  }'

Response: Create two vendors at once Permalink Get a link to this section

The successful response returns a payload similar to the following.

The responses field is an object map containing idempotency_key-vendor pairs. The key is the same as specified in the request and the object is the corresponding Vendor object just created.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
{
    "responses": {
        "0432162f-e3d4-4627-ad5f-f60794f220c3": {
            "vendor": {
                "id": "CARJMAFUWDYBTPO2",
                "created_at": "2021-12-16T03:57:11.128Z",
                "updated_at": "2021-12-16T03:57:11.128Z",
                "name": "Vendor 2A",
                "contacts": [
                    {
                        "id": "IPSTXCGSCXC5HU2P",
                        "name": "Vendor B's Contact",
                        "email_address": "annie@acme.com",
                        "phone_number": "1-212-555-4251",
                        "ordinal": 0
                    }
                ],
                "version": 1,
                "status": "ACTIVE"
            }
        },
        "0e5785ba-8371-48ed-8317-909edc33a08f": {
            "vendor": {
                "id": "5VPCRLENAFZXFZNA",
                "created_at": "2021-12-16T03:57:11.205Z",
                "updated_at": "2021-12-16T03:57:11.205Z",
                "name": "Vendor A",
                "address": {
                    "address_line_1": "101 Main Street",
                    "address_line_2": "Suite 1",
                    "locality": "City",
                    "administrative_district_level_1": "State",
                    "postal_code": "10003",
                    "country": "US"
                },
                "contacts": [
                    {
                        "id": "HB5S4SB2EXYGKVJ3",
                        "name": "Vendor A's Contact",
                        "email_address": "joe@acme.com",
                        "phone_number": "1-212-555-4250",
                        "ordinal": 0
                    }
                ],
                "account_number": "4025391",
                "note": "a vendor",
                "version": 1,
                "status": "ACTIVE"
            }
        }
    }
}

If you call the same BulkCreateVendors request again, you get the same previous response. You can call SearchVendors, querying against the vendors' name values, to verify that no duplicate vendor objects are created by repeated calls to BulkCreateVendors.

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.