Working with affinity groups

Querying for affinity groups

To query for information about affinity groups, use the following endpoints:

  • GET /admin/v1/affinity-groups
  • GET /admin/v1/affinity-groups/{affinityGroupId}

For example, the following query retrieves information about affinity group pc:707:

GET /admin/v1/affinity-groups/pc:707

{
    "data": {
        "attributes": {
            "affinityGroupType": {
                "code": "Open",
                "name": "Open"
            },
            "id": "pc:707",
            "jurisdictions": [
                {
                    "code": "CA",
                    "name": "California"
                }
            ],
            "name": "West Coast WC Affinity Group",
            "primaryContactFirstName": "Rochelle",
            "primaryContactLastName": "Nwodim",
            "primaryContactPhone": {
                "countryCode": {
                    "code": "US",
                    "name": "United States (1)"
                }
            },
            "products": [
                "WorkersComp"
            ],
            "startDate": "2020-09-09T00:00:00.000Z"
        },
        ....

Creating affinity groups

To create an affinity group, use the following endpoint:

  • POST /admin/v1/affinity-groups

The only required attributes are:

  • affinityGroupType - Set to a value from the AffinityGroupType typelist (either Open or Closed)
  • name - Set to the group name

For example, the following request creates a minimal affinity group:

POST /admin/v1/affinity-groups

{
  "data": {
    "attributes": {
        "affinityGroupType": {
            "code": "Open"
        },
        "name": "Cloud API Affinity Group 1"
    }
  }
}

The following request creates a more robust affinity group:

POST /admin/v1/affinity-groups

{
  "data": {
    "attributes": {
        "affinityGroupType": {
            "code": "Closed"
        },
        "jurisdictions": [
            {
                "code": "NY"
            }
            ],
        "name": "Cloud API Affinity Group 2",
        "organization": {
            "id": "pc:5"
        },
        "primaryContactFirstName": "Elizabeth",
        "primaryContactLastName": "Madison",
        "products": [
            "WorkersComp"
        ],
        "startDate": "2022-10-18T00:00:00.000Z"
    }
  }
}

Modifying affinity groups

To PATCH an affinity group, use the following endpoint:

  • PATCH /admin/v1/affinity-groups/{affinityGroupId}

For example, the following request PATCHes affinity group pc:707 by adding a description.

PATCH /admin/v1/affinity-groups/pc:707

{
  "data": {
    "attributes": {
        "description": "Affinity group for WC policies in the Western region"
    }
  }
}

There is no endpoint in Cloud API to delete an affinity group.