---
title: "Associate a facility with a network"
method: POST
path: "/facilities/{id}/networks"
tags: ["Facility"]
---

# Associate a facility with a network

`POST /facilities/{id}/networks`

Associates a facility with a network following the roster ingestion pattern. The network must belong to a group (groupId provided in request body). If the facility is not associated with the group, the group association will also be created simultaneously. Validates that the network belongs to the specified group before creating the association. Supports three request shapes, each with different conflict behavior: (1) legacy single networkId — always upserts the TenantGroupFacilityNetwork relationship with no pre-check, silently updating an existing association rather than rejecting it; (2) bulk networkIds or (3) grouped networkAssociations — both explicitly check for an existing active association per facility-network and per facility-location-network pair first, and return 409 Conflict if one already exists rather than silently updating it. Choose the bulk/grouped shapes when you need to detect pre-existing associations instead of upserting over them.

## Path parameters

- `id` string, required

## Headers

- `tenant-id` string

## Request body

- AssociateFacilityNetworkRequest — Request to associate a facility with one or more networks
  - `groupId` string, required — ID of the group that the network belongs to
  - `networkId` string — Single network ID (legacy). Mutually exclusive with networkIds.
  - `networkIds` string[] — Bulk network IDs (CP-32346). Mutually exclusive with networkId.
  - `includeAllActiveFacilityLocations` boolean — When true, associate all active facility locations under the facility/group
  - `facilityLocationIds` string[] — Certify location IDs to associate (optional when includeAllActiveFacilityLocations is true)
  - `networkEffectiveDate` string — Effective date for facility and location network associations
  - `groupEffectiveDate` string — Effective date for the TenantGroupFacility relationship
  - `networkAssociations` NetworkAssociationEntry[] — Grouped network associations (CP-32346): one entry per network, each with its own effective date. Allows associating multiple networks with different effective dates in a single request. Mutually exclusive with networkId/networkIds.
    - `networkId` string, required — Network ID for this association
    - `effectiveDate` string — Effective date applied to this network
  - `legacySingleNetworkRequest` boolean
  - `groupedNetworkRequest` boolean
  - `bulkNetworkRequest` boolean
  - `networkInputValid` boolean

## Response `201`

Successfully associated facility with network

- AssociateFacilityNetworkResponse — Response containing facility-network association result
  - `tenantGroupFacilityId` string — ID of the tenant group facility
  - `tenantGroupFacilityNetworkId` string — ID of the tenant group facility network association (legacy / first network)
  - `networkId` string — ID of the network that was associated (legacy / first network)
  - `status` string — Indicates the result of the association
  - `facilityNetworkCount` integer — Number of facility-network associations created or updated
  - `locationNetworkCount` integer — Number of facility-location-network associations created
  - `associations` FacilityNetworkAssociationItem[] — Per-network association details for bulk requests
    - `networkId` string — Network ID
    - `tenantGroupFacilityNetworkId` string — TenantGroupFacilityNetwork ID
    - `tenantGroupLocationFacilityNetworkIds` string[] — Created TenantGroupLocationFacilityNetwork IDs

## Other responses

- `400` — Bad request - Invalid input or validation error
- `401` — Unauthorized - Authentication required
- `403` — Forbidden - Insufficient permissions
- `404` — Facility, group, or network not found, or network does not belong to the group
- `409` — Conflict - active facility or facility location network association already exists
- `500` — Internal server error

---

[API](https://skmtc.net/certifyos/apis/certify-api-layer.md) · [All operations](https://skmtc.net/certifyos/apis/certify-api-layer/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/certifyos/certify-api-layer/revisions/563848e0ecc0/schema)
