---
title: "Detach an artifact from a job"
method: POST
path: "/v1/jobs/{job_id}/actions/detach_artifact"
tags: ["Other"]
---

# Detach an artifact from a job

`POST /v1/jobs/{job_id}/actions/detach_artifact`

## Request

- Base URL: `https://api.yardstick.team`
- URL: `https://api.yardstick.team/v1/jobs/{job_id}/actions/detach_artifact`
- Auth: HTTP bearer

Detach an artifact from a job

**Required scopes:** `jobs:write`

Required scopes: `jobs:write` plus the artifact's own write scope — `interview_plans:write` for artifact_type `interview_plan`, `job_postings:write` for `job_posting`, `applications:write` for `application`. The machine-readable `security` array lists only `jobs:write` because OpenAPI cannot express a scope that depends on the request body; the artifact write scope is enforced server-side and a caller missing it receives HTTP 403 `insufficient_scope`.

**Example (curl):**

```bash
curl -X POST https://api.yardstick.team/v1/jobs/job_abc123/actions/detach_artifact \
  -H 'Authorization: Bearer ys_sk_live_…' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: 7c3a…' \
  -d '{"artifact_type":"job_posting","artifact_id":"jp_xyz789"}'
```

**Example (TypeScript):**

```ts
await fetch(
  "https://api.yardstick.team/v1/jobs/job_abc123/actions/detach_artifact",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.YS_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": crypto.randomUUID(),
    },
    body: JSON.stringify({
      artifact_type: "job_posting",
      artifact_id: "jp_xyz789",
    }),
  },
).then((r) => r.json());
```

## Headers

- `Idempotency-Key` string
- `X-Request-Id` string

## Request body

- object
  - `artifact_type` 'interview_plan' | 'job_posting' | 'application', required
  - `artifact_id` string, required

## Response `200`

Success

- object

## Other responses

- `400`: Invalid request
- `401`: Authentication failure
- `403`: Permission denied (scope or feature flag)
- `404`: Resource not found. The error uses the resource-specific code and param names the exact body field or path parameter that referenced it.
- `409`: Conflict (e.g. idempotency key reuse with different body)
- `429`: Rate limited
- `500`: Internal error

---

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