---
title: "Apply global template → user project (missing keys only)"
method: POST
path: "/api/data-access/defaults-template/apply"
tags: ["DataAccess"]
---

# Apply global template → user project (missing keys only)

`POST /api/data-access/defaults-template/apply`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/data-access/defaults-template/apply`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

For each `template.resources` key missing on the target project, copies that resource policy. **Never overwrites** existing `resources.*`.

**Auth:** **admin** or **owner** on `target_project_id`.

**Errors:** 400 if target is ecosystem project (use `PUT /policy/{r}`); 400 if template has no resources and no field_triggers. **MCP:** `data_access.apply_defaults_template`.

## Query parameters

- `target_project_id` integer, required: Target logical project id (≠1). Example: 1025.

## Headers

- `Idempotency-Key` string

## Response `200`

added_resources[], full updated policy

- unknown

## Other responses

- `400`: Bad Request
- `401`: Not authenticated
- `403`: Insufficient project access (read / admin / owner)
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

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