Add Attachment to Existing Incident
The incident attach endpoint provides a method to attach additional files to an incident by referencing its id and passing the attachment files as multipart form data.
Endpoint
POST /v1/incident/{id}/attach
Supported File Types
| MIME Type | Extension |
|---|---|
image/png |
.png |
image/jpg, image/jpeg |
.jpg, .jpeg |
application/pdf |
.pdf |
message/rfc822 |
.eml |
text/plain |
.txt |
application/vnd.ms-outlook |
.msg |
text/csv |
.csv |
application/msword |
.doc |
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.docx |
application/vnd.ms-excel |
.xls |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.xlsx |
Attachment limits
A single request can include up to 12 files by repeating the attachments multipart field, and the total request size must stay under 10 MB. See Limits for details, including the 413 response shape.
Request Example
import requests
incident_id = "abcef3123123"
with open("/path/to/file-1.pdf", "rb") as file_1, open("/path/to/file-2.png", "rb") as file_2:
response = requests.post(
f"https://capi.phishfort.com/v1/incident/{incident_id}/attach",
headers={"x-api-key": "YOUR_API_KEY"},
files=[
("attachments", file_1),
("attachments", file_2),
],
)
print(response.json())
const fs = require("fs");
const FormData = require("form-data");
const incidentId = "abcef3123123";
const form = new FormData();
form.append("attachments", fs.createReadStream("/path/to/file-1.pdf"));
form.append("attachments", fs.createReadStream("/path/to/file-2.png"));
const response = await fetch(
`https://capi.phishfort.com/v1/incident/${incidentId}/attach`,
{
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
...form.getHeaders(),
},
body: form,
}
);
const data = await response.json();
console.log(data);
Where {id} is the ID of the incident you wish to attach files to.
The success message is the same for single- and multi-file uploads; a 200 response means all accepted parts were stored against the incident.
Response Example
In the case of a successful request, the endpoint will return status code 200 with a relevant message. If the incident cannot be found, a 404 response will be returned.