Delete an attachment
curl --request DELETE \
--url https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}import requests
url = "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "ATTACHMENT_ADMIN_REQUIRED",
"origin": "ATTACHMENT",
"message": "Organization admin required"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "ATTACHMENT_NOT_FOUND",
"origin": "ATTACHMENT",
"message": "Attachment not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "ATTACHMENT",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "attachmentId",
"message": "Invalid UUID",
"code": "ATTACHMENTID_UUID"
}
]
}Delete an attachment
Deletes an attachment.
DELETE
/
realms
/
{realmId}
/
organizations
/
{organizationId}
/
attachments
/
{attachmentId}
Delete an attachment
curl --request DELETE \
--url https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}import requests
url = "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attachment.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/attachments/{attachmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "ATTACHMENT_ADMIN_REQUIRED",
"origin": "ATTACHMENT",
"message": "Organization admin required"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "ATTACHMENT_NOT_FOUND",
"origin": "ATTACHMENT",
"message": "Attachment not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "ATTACHMENT",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "attachmentId",
"message": "Invalid UUID",
"code": "ATTACHMENTID_UUID"
}
]
}Only admins of the organization (or of the realm) can delete one. Deleting is permanent — there is no undo — and no new download link is issued for the file afterwards; a link issued before stays valid until it expires, at most 10 minutes later. The attachment itself stays readable, with
status: DELETED.
Deleting an attachment that is already deleted succeeds again (204), so a retry is safe.Path Parameters
ID of your realm.
Format: UUID
ID of the organization the attachment belongs to.
Format: UUID
ID of the attachment, as returned when it was created.
Format: UUID
Response
No Content. The operation succeeded and the response has no body.