> For the complete documentation index, see [llms.txt](https://guardian.hedera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guardian.hedera.com/api-reference-guardian/guardian-policies/artifacts.md).

# Artifacts

Files and documents attached to policies and policy blocks.

## Returns all artifacts.

> Returns all artifacts.

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ArtifactDTOItem":{"type":"object","properties":{"createDate":{"type":"string"},"updateDate":{"type":"string"},"uuid":{"type":"string"},"policyId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["JSON","Executable Code"]},"owner":{"type":"string"},"extention":{"type":"string"},"category":{"type":"string","enum":["policy","tool"]},"creator":{"type":"string"},"id":{"type":"string"}},"required":["createDate","updateDate","uuid","policyId","name","type","owner","extention","id"]},"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts":{"get":{"description":"Returns all artifacts.","operationId":"ArtifactApi_getArtifactsV2_2","parameters":[{"name":"id","required":false,"in":"query","description":"Artifact identifier","schema":{"type":"string"}},{"name":"type","required":false,"in":"query","description":"Tool|Policy","schema":{"enum":["tool","policy"],"type":"string"}},{"name":"policyId","required":false,"in":"query","description":"Policy identifier","schema":{"type":"string"}},{"name":"toolId","required":false,"in":"query","description":"Tool identifier","schema":{"type":"string"}},{"name":"pageIndex","required":false,"in":"query","description":"The number of pages to skip before starting to collect the result set","schema":{"type":"number"}},{"name":"pageSize","required":false,"in":"query","description":"The numbers of items to return","schema":{"type":"number"}}],"responses":{"200":{"description":"Successful operation.","headers":{"X-Total-Count":{"schema":{"type":"integer"},"description":"Total items in the collection."}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ArtifactDTOItem"}}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Returns all artifacts.","tags":["artifacts"]}}}}
```

## Upload artifact.

> Upload artifact. For users with the Standard Registry role only.

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UploadArtifactsDTO":{"type":"object","properties":{"artifacts":{"description":"Artifact files","type":"array","items":{"type":"string","format":"binary"}}},"required":["artifacts"]},"ArtifactDTOItem":{"type":"object","properties":{"createDate":{"type":"string"},"updateDate":{"type":"string"},"uuid":{"type":"string"},"policyId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["JSON","Executable Code"]},"owner":{"type":"string"},"extention":{"type":"string"},"category":{"type":"string","enum":["policy","tool"]},"creator":{"type":"string"},"id":{"type":"string"}},"required":["createDate","updateDate","uuid","policyId","name","type","owner","extention","id"]},"BadRequestErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"error":{"type":"string"}},"required":["statusCode","message"]},"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"UnprocessableEntityErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts/{parentId}":{"post":{"description":"Upload artifact. For users with the Standard Registry role only.","operationId":"ArtifactApi_uploadArtifacts","parameters":[{"name":"parentId","required":true,"in":"path","description":"Parent ID","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"Form data with artifacts.\n\nDefault:\n- artifacts: [&lt;binary file&gt;]\n\nModified:\n- artifacts: [&lt;binary file 1&gt;, &lt;binary file 2&gt;]","content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadArtifactsDTO"}}}},"responses":{"201":{"description":"Artifacts uploaded successfully.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ArtifactDTOItem"}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestErrorDTO"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"422":{"description":"Unprocessable entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntityErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Upload artifact.","tags":["artifacts"]}}}}
```

## Delete artifact.

> Delete artifact.

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts/{artifactId}":{"delete":{"description":"Delete artifact.","operationId":"ArtifactApi_deleteArtifact","parameters":[{"name":"artifactId","required":true,"in":"path","description":"Artifact ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"boolean"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Delete artifact.","tags":["artifacts"]}}}}
```

## Download file by id.

> Returns file from GridFS by its identifier.

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts/files/{fileId}":{"get":{"description":"Returns file from GridFS by its identifier.","operationId":"ArtifactApi_downloadFile","parameters":[{"name":"fileId","required":true,"in":"path","description":"File identifier","schema":{"type":"string"}}],"responses":{"201":{"description":"Successful operation. Returns file content.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized request.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Download file by id.","tags":["artifacts"]}}}}
```

## Delete file by id

> Deletes file from GridFS by \_id

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"BadRequestErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"error":{"type":"string"}},"required":["statusCode","message"]},"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts/files/{fileId}":{"delete":{"description":"Deletes file from GridFS by _id","operationId":"ArtifactApi_deleteFile","parameters":[{"name":"fileId","required":true,"in":"path","description":"File identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestErrorDTO"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Delete file by id","tags":["artifacts"]}}}}
```

## Uploads/overwrites file

> Uploads/overwrites file in GridFS

```json
{"openapi":"3.2.0","info":{"title":"Guardian","version":"3.7.1"},"tags":[{"name":"artifacts","description":"Files and documents attached to policies and policy blocks.","parent":"guardian-policies"}],"servers":[{"url":"/api/v1","description":"API v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UpsertFileResponseDTO":{"type":"object","properties":{"fileId":{"type":"string","description":"File identifier"},"filename":{"type":"string","description":"Saved file name"},"contentType":{"type":"string","description":"Saved file content type"}},"required":["fileId","filename","contentType"]},"BadRequestErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"error":{"type":"string"}},"required":["statusCode","message"]},"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"UnprocessableEntityErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/artifacts/files":{"post":{"description":"Uploads/overwrites file in GridFS","operationId":"ArtifactApi_upsertFile","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"fileId":{"type":"string","description":"Existing file _id to overwrite (optional)"}}}}}},"responses":{"201":{"description":"File uploaded successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertFileResponseDTO"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestErrorDTO"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"422":{"description":"Unprocessable entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntityErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Uploads/overwrites file","tags":["artifacts"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guardian.hedera.com/api-reference-guardian/guardian-policies/artifacts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
