SPB Git

Repository Public

code.md 8.3 KB 293 lines markdown

1---2title: Code3url: https://platform.claude.com/docs/en/api/compliance/code4---56# Code78## Code › Artifacts910### List Code Artifacts1112**GET** `/v1/compliance/apps/code/artifacts`1314List Claude Code Artifacts owned by organizations under the parent15organization.1617Results are sorted by Artifact identifier. Pages may be short or empty18while `next_page` is still set — continue until `next_page` is absent.19Artifacts are sorted by identifier (not creation time): an Artifact20published during an export may land before the cursor and be omitted, so21for a point-in-time-complete export re-enumerate after publishing22quiesces.2324Artifacts owned by a since-deleted child organization are not25returned.2627#### Query parameters2829- `limit: optional number`3031  Maximum results (default: 20, max: 100)3233  default: 20, maximum: 100, minimum: 13435- `organization_ids: optional array of string`3637  Filter by organization IDs (accepts `org_...` or organization UUID, up to 500). Enumerate IDs via `GET /v1/compliance/organizations`.3839  maxItems: 5004041- `page: optional string`4243  Opaque pagination token from a previous response's `next_page` field. Pass this to retrieve the next page of results. Clients should treat this value as an opaque string and not attempt to parse or interpret its contents, as the format may change without notice.4445- `updated_at: optional object`4647  - `gt: optional string`4849    Return only Artifacts updated after this time (RFC 3339 format). See `updated_at.gte` for the completeness caveat.5051    format: date-time5253  - `gte: optional string`5455    Return only Artifacts updated at or after this time (RFC 3339 format). Time filters match an eventually-consistent index and Artifacts published before this field was recorded never match — omit the time filter for compliance-complete enumeration. For incremental export, apply a generous overlap margin between windows and dedupe by `id`: adjacent tiling silently misses items whose index update lagged their publish.5657    format: date-time5859  - `lt: optional string`6061    Return only Artifacts updated before this time (RFC 3339 format). Multiple time operators are AND-ed to the tightest bound. See `updated_at.gte` for the completeness caveat.6263    format: date-time6465  - `lte: optional string`6667    Return only Artifacts updated at or before this time (RFC 3339 format). See `updated_at.gte` for the completeness caveat.6869    format: date-time7071- `user_ids: optional array of string`7273  Filter by owner user IDs (up to 200). Enumerate IDs via `GET /v1/compliance/organizations/{org_uuid}/users`.7475  maxItems: 2007677#### Headers7879- `"x-api-key": optional string`8081#### Returns8283- `data: array of object`8485  Page of Artifacts8687  - `id: string`8889    Artifact identifier (tagged ID)9091  - `organization_uuid: string`9293    Organization UUID this Artifact belongs to9495  - `owner_user_id: string or null`9697    Artifact owner's user identifier (tagged ID), or null for Artifacts published by an agent session rather than a user account. When set, it survives after the owner's account is deleted or the owner leaves every organization under the parent.9899  - `published_version_id: string or null`100101    Identifier of the version a non-owner viewer would render when `read_mode` permits them — the version the owner has pinned for non-owner readers if one is pinned, otherwise the owner's latest. When `read_mode` is `owner` no non-owner renders any version; the field still reports which version would be served were read_mode widened.102103  - `read_mode: "org" or "owner" or "public" or "users"`104105    Who can view this Artifact: only its owner, a named set of users, every member of its organization, or anyone on the internet (`public`)106107    - `"org"`108109    - `"owner"`110111    - `"public"`112113    - `"users"`114115  - `updated_at: string or null`116117    Artifact last update timestamp, or null for Artifacts published before this field was recorded118119    format: date-time120121  - `user: object or null`122123    The user who owns a Code Artifact.124125    Fields that reference this type are null when the Artifact was126    published by an agent session rather than a user account, when the127    owner's account has been deleted, or when the owner is no longer a128    member of an organization the key may read.129130    - `id: string`131132      User identifier (tagged ID)133134    - `email_address: string`135136      User's email address137138  - `versions: array of object`139140    Up to roughly 20 most-recently-published versions of this Artifact (older versions are not retained). Metadata only — use `GET /v1/compliance/apps/code/artifacts/{artifact_id}/versions/{version_id}` to download a version's content.141142    - `id: string`143144      Opaque version identifier145146    - `created_at: string or null`147148      When this version was published149150      format: date-time151152    - `name: string`153154      Artifact title at this version. Falls back to the version identifier when the title for an older version is no longer retained.155156- `has_more: boolean`157158  Whether `next_page` is set. May be true for a page whose next page is empty — continue until `next_page` is absent.159160- `next_page: string or null`161162  Token to retrieve the next page. Use this as the 'page' parameter in your next request163164#### Example165166```bash167curl https://api.anthropic.com/v1/compliance/apps/code/artifacts \168    -H 'anthropic-version: 2023-06-01' \169    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"170```171172##### Response (200)173174```json175{176  "data": [177    {178      "id": "cart_01Tu9VwXyZaBcDeFgHiJkLmN",179      "organization_uuid": "a1b2c3d4-e5f6-4789-a012-3456789abcde",180      "owner_user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q",181      "published_version_id": "1741803761-9f3a",182      "read_mode": "org",183      "updated_at": "2025-03-14T09:05:17.456789Z",184      "user": {185        "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",186        "email_address": "jane.doe@example.com"187      },188      "versions": [189        {190          "id": "1741803761-9f3a",191          "created_at": "2025-03-12T18:22:41.123456Z",192          "name": "Team dashboard"193        }194      ]195    }196  ],197  "has_more": true,198  "next_page": "cGFnZV90b2tlbl9leGFtcGxlXzE3MzQ1Njc4OTA="199}200```201202### Download Code Artifact Version Content203204**GET** `/v1/compliance/apps/code/artifacts/{artifact_id}/versions/{version_id}`205206Streams the content of one version of a Claude Code Artifact as the207response body.208209Returns 404 for Artifacts that don't exist or belong to another parent210organization. A listed version id can start returning 404 if subsequent211publishes rotated it out of retained history — re-list on 404. Returns212503 while the version's content upload is213still in flight or was abandoned — retry with backoff. Oversized214encoded content aborts mid-stream: headers and initial bytes arrive215but the body terminates early — an aborted chunked transfer is the216only truncation signal for encoded content. `Content-MD5` is emitted217only for identity-stored content; validate against it when present.218219#### Path parameters220221- `artifact_id: string`222223  The Artifact ID (tagged ID, e.g., cart_abc123)224225- `version_id: string`226227  Opaque version identifier from the Artifact's `versions` list228229#### Headers230231- `"x-api-key": optional string`232233#### Example234235```bash236curl https://api.anthropic.com/v1/compliance/apps/code/artifacts/$ARTIFACT_ID/versions/$VERSION_ID \237    -H 'anthropic-version: 2023-06-01' \238    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"239```240241### Delete Code Artifact242243**DELETE** `/v1/compliance/apps/code/artifacts/{artifact_id}`244245Permanently deletes a Code Artifact and all its versions. This is a246destructive operation that cannot be undone. A 200 response means the247deletion is initiated and the Artifact is claimed; content removal248completes asynchronously.249250Returns 404 for Artifacts that don't exist or belong to another parent251organization. Returns 404 on a repeated delete of an already-deleted252Artifact.253254#### Path parameters255256- `artifact_id: string`257258  The Artifact ID (tagged ID, e.g., cart_abc123)259260#### Headers261262- `"x-api-key": optional string`263264#### Returns265266- `type: "code_artifact_deleted"`267268  Constant string confirming deletion269270  default: code_artifact_deleted271272- `id: string`273274  The ID of the Artifact that was deleted275276#### Example277278```bash279curl https://api.anthropic.com/v1/compliance/apps/code/artifacts/$ARTIFACT_ID \280    -X DELETE \281    -H 'anthropic-version: 2023-06-01' \282    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"283```284285##### Response (200)286287```json288{289  "id": "cart_xyz789",290  "type": "code_artifact_deleted"291}292```293
Files main
Menu

Theme