99 content : REST API · Artifacts
1010---
1111
12- import { LinkCard , MetaInfo , Type , TypeScriptExample } from " ~/components" ;
12+ import { LinkCard , MetaInfo , Type } from " ~/components" ;
1313
1414Use the Artifacts REST API to manage repos, remotes, forks, imports, and tokens from external systems.
1515
@@ -46,8 +46,6 @@ Returned repo tokens are secrets. Do not log them or store them in long-lived re
4646
4747## Shared types
4848
49- <TypeScriptExample >
50-
5149``` ts
5250export type NamespaceName = string ;
5351export type RepoName = string ;
@@ -121,8 +119,6 @@ export interface TokenInfo {
121119}
122120```
123121
124- </TypeScriptExample >
125-
126122## Repos
127123
128124### Create a repo
@@ -138,8 +134,6 @@ Request body:
138134
139135Response type:
140136
141- <TypeScriptExample omitTabs = { true } >
142-
143137``` ts
144138export interface CreateRepoRequest {
145139 name: RepoName ;
@@ -161,8 +155,6 @@ export interface CreateRepoResult {
161155export type CreateRepoResponse = ApiEnvelope <CreateRepoResult >;
162156```
163157
164- </TypeScriptExample >
165-
166158``` bash
167159curl --request POST " $ARTIFACTS_BASE_URL /repos" \
168160 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
@@ -206,8 +198,6 @@ Query parameters:
206198
207199Response type:
208200
209- <TypeScriptExample >
210-
211201``` ts
212202export interface ListReposQuery {
213203 limit? : number ;
@@ -220,8 +210,6 @@ export interface ListReposQuery {
220210export type ListReposResponse = ApiEnvelope <RepoInfo []>;
221211```
222212
223- </TypeScriptExample >
224-
225213``` bash
226214curl " $ARTIFACTS_BASE_URL /repos?limit=20&sort=updated_at&direction=desc" \
227215 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN "
@@ -259,14 +247,10 @@ Route: `GET /repos/:name`
259247
260248Response type:
261249
262- <TypeScriptExample omitTabs = { true } >
263-
264250``` ts
265251export type GetRepoResponse = ApiEnvelope <RemoteRepoInfo >;
266252```
267253
268- </TypeScriptExample >
269-
270254``` bash
271255curl " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO " \
272256 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN "
@@ -300,8 +284,6 @@ This route returns `202 Accepted`.
300284
301285Response type:
302286
303- <TypeScriptExample omitTabs = { true } >
304-
305287``` ts
306288export interface DeleteRepoResult {
307289 id: string ;
@@ -310,8 +292,6 @@ export interface DeleteRepoResult {
310292export type DeleteRepoResponse = ApiEnvelope <DeleteRepoResult >;
311293```
312294
313- </TypeScriptExample >
314-
315295``` bash
316296curl --request DELETE " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO " \
317297 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN "
@@ -341,8 +321,6 @@ Request body:
341321
342322Response type:
343323
344- <TypeScriptExample omitTabs = { true } >
345-
346324``` ts
347325export interface ForkRepoRequest {
348326 name: RepoName ;
@@ -358,8 +336,6 @@ export interface ForkRepoResult extends CreateRepoResult {
358336export type ForkRepoResponse = ApiEnvelope <ForkRepoResult >;
359337```
360338
361- </TypeScriptExample >
362-
363339``` bash
364340curl --request POST " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO /fork" \
365341 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
@@ -403,8 +379,6 @@ Request body:
403379
404380Response type:
405381
406- <TypeScriptExample omitTabs = { true } >
407-
408382``` ts
409383export interface ImportRepoRequest {
410384 url: string ;
@@ -416,8 +390,6 @@ export interface ImportRepoRequest {
416390export type ImportRepoResponse = ApiEnvelope <CreateRepoResult >;
417391```
418392
419- </TypeScriptExample >
420-
421393Pass a full HTTPS Git remote URL, for example ` https://github.com/facebook/react ` or ` https://gitlab.com/group/project.git ` .
422394
423395``` bash
@@ -464,8 +436,6 @@ Query parameters:
464436
465437Response type:
466438
467- <TypeScriptExample omitTabs = { true } >
468-
469439``` ts
470440export interface ListTokensQuery {
471441 state? : TokenState | " all" ;
@@ -476,8 +446,6 @@ export interface ListTokensQuery {
476446export type ListTokensResponse = ApiEnvelope <TokenInfo []>;
477447```
478448
479- </TypeScriptExample >
480-
481449``` bash
482450curl " $ARTIFACTS_BASE_URL /repos/$ARTIFACTS_REPO /tokens?state=all&per_page=30&page=1" \
483451 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN "
@@ -519,8 +487,6 @@ Request body:
519487
520488Response type:
521489
522- <TypeScriptExample omitTabs = { true } >
523-
524490``` ts
525491export interface CreateTokenRequest {
526492 repo: RepoName ;
@@ -538,8 +504,6 @@ export interface CreateTokenResult {
538504export type CreateTokenResponse = ApiEnvelope <CreateTokenResult >;
539505```
540506
541- </TypeScriptExample >
542-
543507``` bash
544508curl --request POST " $ARTIFACTS_BASE_URL /tokens" \
545509 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
@@ -571,8 +535,6 @@ Route: `DELETE /tokens/:id`
571535
572536Response type:
573537
574- <TypeScriptExample omitTabs = { true } >
575-
576538``` ts
577539export interface RevokeTokenResult {
578540 id: string ;
@@ -581,8 +543,6 @@ export interface RevokeTokenResult {
581543export type RevokeTokenResponse = ApiEnvelope <RevokeTokenResult >;
582544```
583545
584- </TypeScriptExample >
585-
586546``` bash
587547curl --request DELETE " $ARTIFACTS_BASE_URL /tokens/tok_123" \
588548 --header " Authorization: Bearer $CLOUDFLARE_API_TOKEN "
@@ -603,8 +563,6 @@ curl --request DELETE "$ARTIFACTS_BASE_URL/tokens/tok_123" \
603563
604564Application errors also use the v4 envelope:
605565
606- <TypeScriptExample omitTabs = { true } >
607-
608566``` ts
609567export interface ApiError {
610568 code: number ;
@@ -616,8 +574,6 @@ export interface ApiError {
616574}
617575```
618576
619- </TypeScriptExample >
620-
621577## Next steps
622578
623579<LinkCard
0 commit comments