Create a registration attachment
/v1/compliance/attachmentsimport { readFile } from "node:fs/promises";
const attachment = await bird.complianceAttachments.create({
file: new Blob([await readFile("proof-of-address.pdf")]),
filename: "proof-of-address.pdf",
description: "Utility bill for the registered address",
});
// Cite this id as the answer's attachment_id in a submission.
console.log(attachment.id, attachment.content_type);with open("proof-of-address.pdf", "rb") as f:
attachment = client.compliance_attachments.create(
file=f,
filename="proof-of-address.pdf",
description="Utility bill for the registered address",
)
# Cite this id as the answer's attachment_id in a submission.
print(attachment.id, attachment.content_type)file, err := os.Open("proof-of-address.pdf")
if err != nil {
log.Fatal(err)
}
defer func() { _ = file.Close() }()
attachment, err := client.ComplianceAttachments.Create(context.Background(), bird.ComplianceAttachmentsCreateParams{
File: file,
Filename: "proof-of-address.pdf",
Description: bird.Ptr("Utility bill for the registered address"),
})
if err != nil {
log.Fatal(err)
}
// Cite this id as the answer's attachment_id in a submission.
fmt.Println(attachment.Id, attachment.ContentType)$contents = file_get_contents('proof-of-address.pdf');
if ($contents === false) {
exit("Cannot read proof-of-address.pdf\n");
}
$attachment = $bird->complianceAttachments->create(
$contents,
'proof-of-address.pdf',
'Utility bill for the registered address',
);
// Cite this id as the answer's attachment_id in a submission.
echo $attachment->getId(), ' ', $attachment->getContentType(), "\n";bird compliance attachments upload --file ./document.pdfcurl -X POST "https://us1.platform.bird.com/v1/compliance/attachments" \
-H "Authorization: Bearer $TOKEN" \
-F 'file=@./file'{
"created_at": "2026-05-20T09:14:52Z",
"updated_at": "2026-05-25T16:42:01Z",
"id": "tca_01krdgeqcxet5s7t44vh8rt9mg",
"status": "draft"
}
Uploads a document that answers a compliance requirement, such as the proof
of address a country asks for before it approves a number. Send the file as a
multipart/form-data body with the bytes in a file part.
A requirement whose data_type is document is answered with attachment IDs
rather than a typed value. Pass the returned ID as the answer's
attachment_id, or in its attachment_ids where the requirement accepts
several. Upload before you file the submission that cites the attachment. An
unused attachment expires after seven days. After a submission cites it, the
attachment no longer expires and you can reuse it elsewhere in the workspace,
including as evidence for a 10DLC registration. Toll-free verification
evidence must be a PNG or JPEG image.
PNG, JPEG, and PDF files up to 10 MB are accepted. Uploading a file whose contents match an existing attachment returns that attachment instead of creating a duplicate.
Payload Respons
created_atupdated_atidfilenameThe uploaded file's name.
content_typeThe file's content type, determined from its contents.
size_bytesThe file's size in bytes.
descriptionA short note describing what the file shows.
statusLifecycle of an attachment. draft is a file that has been uploaded but nothing
has been registered or submitted with it yet, and it is discarded at its
expires_at. attached means at least one registration has cited it, so it is
kept permanently and can no longer be deleted.
Possible values: draft, attached
download_urlShort-lived signed URL for downloading or previewing the attachment. Valid for 24 hours from when the resource was fetched; request a fresh resource to obtain a new URL after expiry. Do not cache beyond download_url_expires_at. Registration authorities (10DLC and toll-free carriers) retrieve evidence via a separate, longer-lived token; this URL is not that token.
preview_urlOptional signed URL for inline viewing on an isolated storage origin. Valid for one hour; fetch the attachment again to refresh it.
download_url_expires_atWhen download_url expires. Both fields are always present; the server returns an error rather than omitting them.
expires_atWhen this attachment is discarded if nothing is registered or submitted with it. Null once its status is attached.
Sumber daya terkait
Lanjutkan dengan dokumentasi, panduan, dan contoh untuk topik ini.