Skip to main content

Attachments

Upload files, such as requisition forms or shipping documents, to a job through the REST API.

Upload an attachment​

POST /api/1.0/vendor/job/{jobId}/attachments

AuthBearer token (see Authentication)
Bodymultipart/form-data with a single file field named file
Max size12 MB
Optional headerx-mpx-checksum-sha1: base64-encoded SHA-1 of the file
curl --request POST \
--url https://mpx-api-sandbox.natera.com/api/1.0/vendor/job/{jobId}/attachments \
--header 'authorization: Bearer eyJhbG[...]1LQ' \
--header 'x-mpx-checksum-sha1: Kq5sNclPz7QV2+lfQIuc6R7oRu0=' \
--form 'file=@document.pdf'

A successful request returns 201 Created with an empty body.

Verifying uploads with a checksum​

To make sure the file wasn't corrupted in transit, send its SHA-1 digest, base64-encoded, in x-mpx-checksum-sha1. If the digest doesn't match the received file, MPX rejects the upload with 400. SHA-1 is currently the only supported algorithm.

openssl dgst -sha1 -binary document.pdf | base64

Errors​

StatusCodeCause
400BAD_REQUESTNo file was sent, or the checksum didn't match.
400LIMIT_FILE_SIZEThe file is larger than 12 MB.
400LIMIT_UNEXPECTED_FILEThe file wasn't sent in a field named file.
403INVALID_JOB_STATEThe job is AVAILABLE. Assign or publish it first.
404JOB_NOT_FOUNDThe job doesn't exist or isn't visible to your vendor.

Upload status​

Uploads are processed asynchronously. Each attachment has an AttachmentUploadStatus:

StatusMeaning
PENDINGWaiting to be uploaded.
SUCCESSUploaded successfully. url is populated.
DUPLICATEThe file's checksum matches an attachment already on the job.
ERRORThe upload failed.

Attachments are only returned by the single-job job query:

query {
job(id: "s@mp!3ID") {
attachments { id mimeType uploadStatus url }
}
}

Adding an attachment also triggers a JOB_UPDATED webhook with attachments in changed.

You can't delete attachments through the API. Contact the MPX Operations team to have one removed.