# Downloads

## GET /api/v2/downloads/{uid}/download

> Download Download

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads/{uid}/download":{"get":{"tags":["downloads"],"summary":"Download Download","operationId":"download_download_api_v2_downloads__uid__download_get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"integer","title":"Uid"}}],"responses":{"200":{"description":"Successful Response"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## POST /api/v2/downloads/{uid}/tags

> Add Tag

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads/{uid}/tags":{"post":{"tags":["downloads"],"summary":"Add Tag","operationId":"add_tag_api_v2_downloads__uid__tags_post","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"integer","title":"Uid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"TagRequest":{"properties":{"name":{"type":"string","pattern":"^[^:]+$","title":"Name"},"value":{"type":"string","pattern":"^[^:]+$","title":"Value"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["name","value"],"title":"TagRequest"},"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## PUT /api/v2/downloads/{uid}/tags/{tag\_id}

> Update Tag

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads/{uid}/tags/{tag_id}":{"put":{"tags":["downloads"],"summary":"Update Tag","operationId":"update_tag_api_v2_downloads__uid__tags__tag_id__put","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"integer","title":"Uid"}},{"name":"tag_id","in":"path","required":true,"schema":{"type":"integer","title":"Tag Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"TagRequest":{"properties":{"name":{"type":"string","pattern":"^[^:]+$","title":"Name"},"value":{"type":"string","pattern":"^[^:]+$","title":"Value"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["name","value"],"title":"TagRequest"},"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## DELETE /api/v2/downloads/{uid}/tags/{tag\_id}

> Delete Tag

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads/{uid}/tags/{tag_id}":{"delete":{"tags":["downloads"],"summary":"Delete Tag","operationId":"delete_tag_api_v2_downloads__uid__tags__tag_id__delete","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"integer","title":"Uid"}},{"name":"tag_id","in":"path","required":true,"schema":{"type":"integer","title":"Tag Id"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## GET /api/v2/downloads/{uid}

> Read Download

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads/{uid}":{"get":{"tags":["downloads"],"summary":"Read Download","operationId":"read_download_api_v2_downloads__uid__get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"integer","title":"Uid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Download"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Download":{"properties":{"id":{"type":"integer","title":"Id"},"location":{"type":"string","title":"Location"},"filename":{"type":"string","title":"Filename"},"size":{"type":"integer","title":"Size"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","title":"Tags"}},"type":"object","required":["id","location","filename","size","created_at","updated_at","tags"],"title":"Download"},"Tag":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"value":{"type":"string","title":"Value"},"label":{"type":"string","title":"Label"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["id","name","value","label"],"title":"Tag"},"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## GET /api/v2/downloads

> Read Downloads

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads":{"get":{"tags":["downloads"],"summary":"Read Downloads","operationId":"read_downloads_api_v2_downloads_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":-1,"title":"Limit"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"order_direction","in":"query","required":false,"schema":{"$ref":"#/components/schemas/OrderDirection","default":"desc"}},{"name":"order_by","in":"query","required":false,"schema":{"$ref":"#/components/schemas/DownloadOrderOptions","default":"updated_at"}},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query"}},{"name":"sources","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DownloadSourceFilter"}},{"type":"null"}],"title":"Sources"}},{"name":"tags","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string","pattern":"^[^:]+:[^:]+$"}},{"type":"null"}],"title":"Tags"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Downloads"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"OrderDirection":{"type":"string","enum":["asc","desc"],"title":"OrderDirection"},"DownloadOrderOptions":{"type":"string","enum":["filename","location","size","created_at","updated_at"],"title":"DownloadOrderOptions"},"DownloadSourceFilter":{"type":"string","enum":["upload","stager","agent_file","agent_task"],"title":"DownloadSourceFilter"},"Downloads":{"properties":{"records":{"items":{"$ref":"#/components/schemas/Download"},"type":"array","title":"Records"},"limit":{"type":"integer","title":"Limit"},"page":{"type":"integer","title":"Page"},"total_pages":{"type":"integer","title":"Total Pages"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["records","limit","page","total_pages","total"],"title":"Downloads"},"Download":{"properties":{"id":{"type":"integer","title":"Id"},"location":{"type":"string","title":"Location"},"filename":{"type":"string","title":"Filename"},"size":{"type":"integer","title":"Size"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","title":"Tags"}},"type":"object","required":["id","location","filename","size","created_at","updated_at","tags"],"title":"Download"},"Tag":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"value":{"type":"string","title":"Value"},"label":{"type":"string","title":"Label"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["id","name","value","label"],"title":"Tag"},"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## POST /api/v2/downloads

> Create Download

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/downloads":{"post":{"tags":["downloads"],"summary":"Create Download","operationId":"create_download_api_v2_downloads_post","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_download_api_v2_downloads_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Download"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_create_download_api_v2_downloads_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_create_download_api_v2_downloads_post"},"Download":{"properties":{"id":{"type":"integer","title":"Id"},"location":{"type":"string","title":"Location"},"filename":{"type":"string","title":"Filename"},"size":{"type":"integer","title":"Size"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"tags":{"items":{"$ref":"#/components/schemas/Tag"},"type":"array","title":"Tags"}},"type":"object","required":["id","location","filename","size","created_at","updated_at","tags"],"title":"Download"},"Tag":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"value":{"type":"string","title":"Value"},"label":{"type":"string","title":"Label"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["id","name","value","label"],"title":"Tag"},"BadRequestResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"BadRequestResponse"},"NotFoundResponse":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"NotFoundResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bc-security.gitbook.io/empire-wiki/restful-api/downloads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
