Creating policy locations

Use the following endpoints to create policy locations for a specific job:

  • POST /job/v1/jobs/{jobId}/locations

There are two ways to create a PolicyLocation:

  • Associate an existing AccountLocation with the policy
  • Specify a new PolicyLocation, which also creates a new AccountLocation and associates the two
Note: The creation functionality for policy contacts is different than it is for policy locations. A contact must exist on the account before it can be added to a policy. But a location that does not already exist on the account can be added to a policy. In this case, the location is added to the account and the policy simultaneously.

To create a policy location by associating an existing AccountLocation with the job, the POST references the id of an existing AccountLocation. For example, the following creates a PolicyLocation for job pc:25 that is linked to the existing AccountLocation pc:881.

POST /job/v1/jobs/pc:25/locations

{
  "data": {
    "attributes": {
      "accountLocation": {
          "id": "pc:881"
      }
    }
  }
}

To create a policy location by specifying a new PolicyLocation, the POST specifies information about the new location. The required information for a location varies based on the locale. For example, for US locations, the minimum amount of information you must specify is:

  • addressLine1
  • city
  • state
  • postalCode

Whenever you specify a new location, PolicyCenter:

  • Creates a new AccountLocation
  • Creates a PolicyLocation that is linked to the new account location

For example, the following specifies a new policy location for job pc:25.

POST /job/v1/jobs/pc:25/locations

{
  "data": {
    "attributes": {
      "addressLine1": "1414 Ming Ave",
      "city": "Bakersfield",
      "state": {
        "code": "CA"
      },
      "postalCode": "90604"
    }
  }
}