1. Groups
  2. Create & Update Groups

Groups

Create & Update Groups

Create Group(s)

POST
`/v1/groups`

This API will allow you to create a single group using a traditional REST approach.

Create Single Group

The only required property for a group is the name and resource type (location or contact)

js
        const data = {
  name: "PackageX Inc",
  type: "contact",
};

fetch(`https://api.packagex.io/v1/groups`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
});

      

Update Group

POST
`/v1/groups/:group`

To update a group, you'll need to pass the group's ID along with any properties that you want to manage.

js
        const data = {
  name: "PackageX Inc.",
};

fetch(`https://api.packagex.io/v1/groups/${group.id}`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
});