99 content : REST API · Artifacts
1010---
1111
12- import { LinkCard , MetaInfo , Type } from " ~/components" ;
12+ import { LinkCard , MetaInfo , Type , TypeScriptExample } from " ~/components" ;
1313
1414Use the Artifacts REST API to manage repos, remotes, forks, imports, and tokens from external systems.
1515
@@ -18,13 +18,13 @@ Use the Artifacts REST API to manage repos, remotes, forks, imports, and tokens
1818Artifacts REST routes use this base path:
1919
2020``` txt
21- https://artifacts.cloudflare.dev /v1/api/namespaces/{namespace}
21+ https://artifacts.cloudflare.net /v1/api/namespaces/{namespace}
2222```
2323
2424Some edge deployments also expose this base path:
2525
2626``` txt
27- https://artifacts.cloudflare.dev /edge/v1/api/namespaces/{namespace}
27+ https://artifacts.cloudflare.net /edge/v1/api/namespaces/{namespace}
2828```
2929
3030Requests to ` /v1/api/... ` use Bearer authentication:
@@ -41,13 +41,17 @@ The following examples assume:
4141export ARTIFACTS_NAMESPACE=" default"
4242export ARTIFACTS_REPO=" starter-repo"
4343export ARTIFACTS_JWT=" <YOUR_GATEWAY_JWT>"
44- export ARTIFACTS_BASE_URL=" https://artifacts.cloudflare.dev /v1/api/namespaces/$ARTIFACTS_NAMESPACE "
44+ export ARTIFACTS_BASE_URL=" https://artifacts.cloudflare.net /v1/api/namespaces/$ARTIFACTS_NAMESPACE "
4545```
4646
4747All responses use the standard Cloudflare v4 envelope.
4848
49+ Returned repo tokens are secrets. Do not log them or store them in long-lived remotes unless your workflow requires it.
50+
4951## Shared types
5052
53+ <TypeScriptExample typescriptFirst = { true } >
54+
5155``` ts
5256export type NamespaceName = string ;
5357export type RepoName = string ;
@@ -121,6 +125,8 @@ export interface TokenInfo {
121125}
122126```
123127
128+ </TypeScriptExample >
129+
124130## Repos
125131
126132### Create a repo
@@ -136,6 +142,8 @@ Request body:
136142
137143Response type:
138144
145+ <TypeScriptExample omitTabs = { true } >
146+
139147``` ts
140148export interface CreateRepoRequest {
141149 name: RepoName ;
@@ -157,6 +165,8 @@ export interface CreateRepoResult {
157165export type CreateRepoResponse = ApiEnvelope <CreateRepoResult >;
158166```
159167
168+ </TypeScriptExample >
169+
160170``` bash
161171curl --request POST " $ARTIFACTS_BASE_URL /repos" \
162172 --header " Authorization: Bearer $ARTIFACTS_JWT " \
@@ -176,9 +186,9 @@ curl --request POST "$ARTIFACTS_BASE_URL/repos" \
176186 "name" : " starter-repo" ,
177187 "description" : " Repository for automation experiments" ,
178188 "default_branch" : " main" ,
179- "remote" : " https://<ACCOUNT >.artifacts.cloudflare.dev /git/default/starter-repo.git" ,
189+ "remote" : " https://<ACCOUNT_ID >.artifacts.cloudflare.net /git/default/starter-repo.git" ,
180190 "token" : " art_v1_0123456789abcdef0123456789abcdef01234567?expires=1760000000" ,
181- "expires_at" : " 2026-04-08T12:00:00.000Z "
191+ "expires_at" : " <ISO_TIMESTAMP> "
182192 },
183193 "success" : true ,
184194 "errors" : [],
@@ -200,6 +210,8 @@ Query parameters:
200210
201211Response type:
202212
213+ <TypeScriptExample typescriptFirst = { true } >
214+
203215``` ts
204216export interface ListReposQuery {
205217 limit? : number ;
@@ -212,6 +224,8 @@ export interface ListReposQuery {
212224export type ListReposResponse = ApiEnvelope <RepoInfo []>;
213225```
214226
227+ </TypeScriptExample >
228+
215229``` bash
216230curl " $ARTIFACTS_BASE_URL /repos?limit=20&sort=updated_at&direction=desc" \
217231 --header " Authorization: Bearer $ARTIFACTS_JWT "
@@ -225,9 +239,9 @@ curl "$ARTIFACTS_BASE_URL/repos?limit=20&sort=updated_at&direction=desc" \
225239 "name" : " starter-repo" ,
226240 "description" : " Repository for automation experiments" ,
227241 "default_branch" : " main" ,
228- "created_at" : " 2026-04-07T12:00:00.000Z " ,
229- "updated_at" : " 2026-04-07T12:30:00.000Z " ,
230- "last_push_at" : " 2026-04-07T12:30:00.000Z " ,
242+ "created_at" : " <ISO_TIMESTAMP> " ,
243+ "updated_at" : " <ISO_TIMESTAMP> " ,
244+ "last_push_at" : " <ISO_TIMESTAMP> " ,
231245 "source" : null ,
232246 "read_only" : false
233247 }
@@ -249,10 +263,14 @@ Route: `GET /repos/:name`
249263
250264Response type:
251265
266+ <TypeScriptExample omitTabs = { true } >
267+
252268``` ts
253269export type GetRepoResponse = ApiEnvelope <RemoteRepoInfo >;
254270```
255271
272+ </TypeScriptExample >
273+
256274``` bash
257275curl " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO " \
258276 --header " Authorization: Bearer $ARTIFACTS_JWT "
@@ -265,12 +283,12 @@ curl "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO" \
265283 "name" : " starter-repo" ,
266284 "description" : " Repository for automation experiments" ,
267285 "default_branch" : " main" ,
268- "created_at" : " 2026-04-07T12:00:00.000Z " ,
269- "updated_at" : " 2026-04-07T12:30:00.000Z " ,
270- "last_push_at" : " 2026-04-07T12:30:00.000Z " ,
286+ "created_at" : " <ISO_TIMESTAMP> " ,
287+ "updated_at" : " <ISO_TIMESTAMP> " ,
288+ "last_push_at" : " <ISO_TIMESTAMP> " ,
271289 "source" : null ,
272290 "read_only" : false ,
273- "remote" : " https://<ACCOUNT >.artifacts.cloudflare.dev /git/default/starter-repo.git"
291+ "remote" : " https://<ACCOUNT_ID >.artifacts.cloudflare.net /git/default/starter-repo.git"
274292 },
275293 "success" : true ,
276294 "errors" : [],
@@ -286,6 +304,8 @@ This route returns `202 Accepted`.
286304
287305Response type:
288306
307+ <TypeScriptExample omitTabs = { true } >
308+
289309``` ts
290310export interface DeleteRepoResult {
291311 id: string ;
@@ -294,6 +314,8 @@ export interface DeleteRepoResult {
294314export type DeleteRepoResponse = ApiEnvelope <DeleteRepoResult >;
295315```
296316
317+ </TypeScriptExample >
318+
297319``` bash
298320curl --request DELETE " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO " \
299321 --header " Authorization: Bearer $ARTIFACTS_JWT "
@@ -323,6 +345,8 @@ Request body:
323345
324346Response type:
325347
348+ <TypeScriptExample omitTabs = { true } >
349+
326350``` ts
327351export interface ForkRepoRequest {
328352 name: RepoName ;
@@ -338,6 +362,8 @@ export interface ForkRepoResult extends CreateRepoResult {
338362export type ForkRepoResponse = ApiEnvelope <ForkRepoResult >;
339363```
340364
365+ </TypeScriptExample >
366+
341367``` bash
342368curl --request POST " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO /fork" \
343369 --header " Authorization: Bearer $ARTIFACTS_JWT " \
@@ -357,9 +383,9 @@ curl --request POST "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO/fork" \
357383 "name" : " starter-repo-copy" ,
358384 "description" : " Repository for automation experiments" ,
359385 "default_branch" : " main" ,
360- "remote" : " https://<ACCOUNT >.artifacts.cloudflare.dev /git/default/starter-repo-copy.git" ,
386+ "remote" : " https://<ACCOUNT_ID >.artifacts.cloudflare.net /git/default/starter-repo-copy.git" ,
361387 "token" : " art_v1_89abcdef0123456789abcdef0123456789abcdef?expires=1760003600" ,
362- "expires_at" : " 2026-04-08T13:00:00.000Z " ,
388+ "expires_at" : " <ISO_TIMESTAMP> " ,
363389 "objects" : 128
364390 },
365391 "success" : true ,
@@ -381,6 +407,8 @@ Request body:
381407
382408Response type:
383409
410+ <TypeScriptExample omitTabs = { true } >
411+
384412``` ts
385413export interface ImportRepoRequest {
386414 url: string ;
@@ -392,6 +420,8 @@ export interface ImportRepoRequest {
392420export type ImportRepoResponse = ApiEnvelope <CreateRepoResult >;
393421```
394422
423+ </TypeScriptExample >
424+
395425Pass a full HTTPS Git remote URL, for example ` https://github.com/facebook/react ` or ` https://gitlab.com/group/project.git ` .
396426
397427``` bash
@@ -412,9 +442,9 @@ curl --request POST "$ARTIFACTS_BASE_URL/repos/react-mirror/import" \
412442 "name" : " react-mirror" ,
413443 "description" : null ,
414444 "default_branch" : " main" ,
415- "remote" : " https://<ACCOUNT >.artifacts.cloudflare.dev /git/default/react-mirror.git" ,
445+ "remote" : " https://<ACCOUNT_ID >.artifacts.cloudflare.net /git/default/react-mirror.git" ,
416446 "token" : " art_v1_fedcba9876543210fedcba9876543210fedcba98?expires=1760007200" ,
417- "expires_at" : " 2026-04-08T14:00:00.000Z "
447+ "expires_at" : " <ISO_TIMESTAMP> "
418448 },
419449 "success" : true ,
420450 "errors" : [],
@@ -436,6 +466,8 @@ Query parameters:
436466
437467Response type:
438468
469+ <TypeScriptExample omitTabs = { true } >
470+
439471``` ts
440472export interface ListTokensQuery {
441473 state? : TokenState | " all" ;
@@ -446,6 +478,8 @@ export interface ListTokensQuery {
446478export type ListTokensResponse = ApiEnvelope <TokenInfo []>;
447479```
448480
481+ </TypeScriptExample >
482+
449483``` bash
450484curl " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO /tokens?state=all&per_page=30&page=1" \
451485 --header " Authorization: Bearer $ARTIFACTS_JWT "
@@ -458,8 +492,8 @@ curl "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO/tokens?state=all&per_page=30&pag
458492 "id" : " tok_123" ,
459493 "scope" : " read" ,
460494 "state" : " active" ,
461- "created_at" : " 2026-04-07T12:00:00.000Z " ,
462- "expires_at" : " 2026-04-07T13:00:00.000Z "
495+ "created_at" : " <ISO_TIMESTAMP> " ,
496+ "expires_at" : " <ISO_TIMESTAMP> "
463497 }
464498 ],
465499 "success" : true ,
@@ -487,6 +521,8 @@ Request body:
487521
488522Response type:
489523
524+ <TypeScriptExample omitTabs = { true } >
525+
490526``` ts
491527export interface CreateTokenRequest {
492528 repo: RepoName ;
@@ -504,6 +540,8 @@ export interface CreateTokenResult {
504540export type CreateTokenResponse = ApiEnvelope <CreateTokenResult >;
505541```
506542
543+ </TypeScriptExample >
544+
507545``` bash
508546curl --request POST " $ARTIFACTS_BASE_URL /tokens" \
509547 --header " Authorization: Bearer $ARTIFACTS_JWT " \
@@ -521,7 +559,7 @@ curl --request POST "$ARTIFACTS_BASE_URL/tokens" \
521559 "id" : " tok_123" ,
522560 "plaintext" : " art_v1_0123456789abcdef0123456789abcdef01234567?expires=1760000000" ,
523561 "scope" : " read" ,
524- "expires_at" : " 2026-04-07T13:00:00.000Z "
562+ "expires_at" : " <ISO_TIMESTAMP> "
525563 },
526564 "success" : true ,
527565 "errors" : [],
@@ -535,6 +573,8 @@ Route: `DELETE /tokens/:id`
535573
536574Response type:
537575
576+ <TypeScriptExample omitTabs = { true } >
577+
538578``` ts
539579export interface RevokeTokenResult {
540580 id: string ;
@@ -543,6 +583,8 @@ export interface RevokeTokenResult {
543583export type RevokeTokenResponse = ApiEnvelope <RevokeTokenResult >;
544584```
545585
586+ </TypeScriptExample >
587+
546588``` bash
547589curl --request DELETE " $ARTIFACTS_BASE_URL /tokens/tok_123" \
548590 --header " Authorization: Bearer $ARTIFACTS_JWT "
@@ -563,6 +605,8 @@ curl --request DELETE "$ARTIFACTS_BASE_URL/tokens/tok_123" \
563605
564606Application errors also use the v4 envelope:
565607
608+ <TypeScriptExample omitTabs = { true } >
609+
566610``` ts
567611export interface ApiError {
568612 code: number ;
@@ -574,6 +618,8 @@ export interface ApiError {
574618}
575619```
576620
621+ </TypeScriptExample >
622+
577623## Next steps
578624
579625<LinkCard
0 commit comments