---
title: "Import a library service"
method: POST
path: "/sites/{id}/services/import"
tags: ["Services"]
---

# Import a library service

`POST /sites/{id}/services/import`

## Request

- Base URL: `http://localhost:3001/api/v1`
- URL: `http://localhost:3001/api/v1/sites/{id}/services/import`
- Auth: HTTP bearer

Imports a service from the cookie library into a site: the service row, all its documented cookies, and the script-blocking rules that keep it from loading before consent. `blockingRulesAdded` reports how many rules were added — 0 when the service is in a required category, is already covered by a built-in rule, or has no known script patterns.

## Path parameters

- `id` string, uuid, required: Site ID

## Request body

- object
  - `slug` string, required
  - `categorySlug` string

## Response `201`

Service imported

- object
  - `service` object, required
    - `id` string, uuid, required
    - `slug` string, required
    - `label` string, required
    - `categoryId` string, uuid, required
  - `cookiesCreated` number, required
  - `blockingRulesAdded` number, required

## Other responses

- `400`: Category not found
- `401`: Unauthorized
- `404`: Site or library service not found
- `409`: Service already exists on site

---

[API](https://skmtc.dev/consentlayer/apis/consentlayer-api.md) · [All operations](https://skmtc.dev/consentlayer/apis/consentlayer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/consentlayer/apis/consentlayer-api/revisions/b89d4b189d50?raw)
