Claude Platform Docs

To enable the Compliance API, see the setup guide.

Set up the Compliance API

Unduh Konten Versi Artifact Kode

GET/v1/compliance/apps/code/artifacts/{artifact_id}/versions/{version_id}

Mengalirkan konten satu versi Artifact Claude Code sebagai isi respons.

Mengembalikan 404 untuk Artifact yang tidak ada atau milik organisasi induk lain. Id versi yang tercantum dapat mulai mengembalikan 404 jika publikasi berikutnya telah mengeluarkannya dari riwayat yang disimpan — lakukan daftar ulang saat mendapat 404. Mengembalikan 503 selama unggahan konten versi masih berlangsung atau telah ditinggalkan — coba ulang dengan backoff. Mengembalikan 422 dengan error.details.error_code multi_file_unavailable untuk versi yang memiliki lebih dari satu file, kecuali permintaan mengatur multi_file_format=zip, yang mengembalikan file-file tersebut sebagai arsip ZIP. Dengan multi_file_format=zip, versi yang memiliki lebih dari satu file, salah satunya dengan nama yang tidak dapat diekspor oleh API, mendapatkan 422 file_set_unavailable. Jangan mencoba ulang 422. Versi Claude Doc hanya berisi halaman web yang menampilkan Doc tersebut dan tidak pernah dikembalikan sebagai ZIP. Halaman tersebut biasanya memiliki lebih dari satu file, sehingga versi Doc biasanya mendapatkan 422 multi_file_unavailable. Unduh teks Doc dengan GET /v1/compliance/apps/code/artifacts/{artifact_id}/content?multi_file_format=zip. Konten ter-encode yang terlalu besar akan dihentikan di tengah stream: header dan byte awal tiba tetapi isi berakhir lebih awal — transfer chunked yang dihentikan adalah satu-satunya sinyal pemotongan untuk konten ter-encode. Content-MD5 hanya dikirimkan untuk konten yang disimpan secara identity; validasikan terhadapnya jika ada.

Path parameters
artifact_id: string

The Artifact ID (tagged ID, e.g., cart_abc123)

version_id: string

Opaque version identifier from the Artifact's versions list

Query parameters
multi_file_format: optional string

Set to zip, its only value, to receive a version that has more than one file as a ZIP archive of its files with an index, files.json. Files the artifact copied from its type (the app that displays every artifact of that type) are listed under omitted_files in the index, and left out of the archive, when an organization other than the artifact's owns that type. A Claude Doc's version never comes back as a ZIP: it is answered as without this parameter, except that a version with more than one file, one of them with a name the API cannot export, gets 422 file_set_unavailable. A version with one file is returned as that file, as without this parameter.

Headers
"anthropic-version": optional string

The version of the Claude API you want to use.

Read more about versioning and our version history here.

"x-api-key": optional string
Unduh Konten Versi Artifact Kode
cURL
curl https://api.anthropic.com/v1/compliance/apps/code/artifacts/$ARTIFACT_ID/versions/$VERSION_ID \
    -H 'anthropic-version: 2023-06-01' \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"