> ## Documentation Index > Fetch the complete documentation index at: https://docs.restaurant365.com/llms.txt > Use this file to discover all available pages before exploring further. # Register Attachment > Step 3 of 3. Links a file already uploaded to Amazon S3 in step 2 to an existing AP transaction. Attachments must be enabled for the organization; if they are not, this endpoint returns 403. ## OpenAPI ````json POST /public/v1/accounting/accounts-payable/attachments { "openapi": "3.0.1", "info": { "title": "R365 Public API", "contact": { "name": "R365 Services Team", "email": "r365@restaurant365.com" }, "version": "1.0" }, "security": [ { "Bearer": [] } ], "paths": { "/public/v1/accounting/accounts-payable/attachments": { "post": { "tags": [ "accounting" ], "summary": "Register Attachment", "description": "Step 3 of 3. Links a file already uploaded to Amazon S3 in step 2 to an existing AP transaction.\n\nAttachments must be enabled for the organization; if they are not, this endpoint returns 403.", "parameters": [ { "$ref": "#/components/parameters/TenantId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterAttachmentRequest" } } } }, "responses": { "200": { "description": "The attachment was registered successfully.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterAttachmentResponse" } } } }, "400": { "description": "Bad Request — a parameter value is malformed, of the wrong type, or outside its allowed range." }, "401": { "description": "Unauthorized — the bearer token is missing, invalid or expired, or is not valid for the specified tenant." }, "403": { "description": "Forbidden — the caller lacks the permission required for this operation, or attachments are not enabled for this organization." }, "404": { "description": "Not Found — no AP transaction exists with the specified formId, or it is not of the type given by formName." }, "409": { "description": "Conflict — the request conflicts with the current state of the resource and cannot be applied." }, "422": { "description": "Unprocessable Entity — a required parameter is missing, or a supplied parameter value is invalid." }, "429": { "description": "Too Many Requests — the caller has exceeded the rate limit; retry after a short delay." }, "500": { "description": "Internal Server Error — an unexpected error occurred while processing the request." } }, "x-d360-narrative-url": "

Attaching a file to an existing AP transaction takes three calls. Only the first and third are Restaurant365 endpoints; the second is a direct upload to Amazon S3 using a URL the first call returns.

  1. Generate Upload URL — POST /public/v1/accounting/accounts-payable/attachments/upload-url

  2. Upload File to S3 — upload the file from your device to the returned URL

  3. Register Attachment — POST /public/v1/accounting/accounts-payable/attachments

Supported AP transaction types are invoices, credit memos and payments. The transaction must already exist; attaching a file is a separate operation from creating the transaction.

" } } }, "components": { "parameters": { "TenantId": { "name": "x-r365-context-tenant-id", "in": "header", "required": true, "description": "Identifies the R365 tenant the request applies to. Required on every request.", "schema": { "type": "string" } } }, "schemas": { "RegisterAttachmentRequest": { "type": "object", "additionalProperties": false, "required": [ "fileName", "formId", "newFileName", "formName", "uploadType", "userId", "fileType" ], "properties": { "formId": { "type": "string", "format": "uuid", "description": "The identifier of the existing AP transaction to attach the file to. This endpoint is not scoped by URL path — the transaction is identified by this field, and its type by formName." }, "formName": { "type": "string", "enum": [ "APInvoiceForm", "APCreditMemoForm", "APPaymentForm" ], "description": "The type of AP transaction being attached to." }, "newFileName": { "type": "string", "description": "The storage file name returned by step 1. Must be the value from that response, not your original file name." }, "fileName": { "type": "string", "description": "The original file name, including extension, as it should be displayed to users in Restaurant365." }, "fileType": { "type": "string", "enum": [ "application/pdf", "image/jpeg", "image/jpg", "image/jpe", "image/png", "image/tiff", "image/tif", "image/heic", "image/bmp", "image/gif", "image/x-jp2", "image/svg+xml", "text/csv", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ], "description": "The MIME content type of the uploaded file. Use the same value sent in step 1." }, "uploadType": { "type": "string", "enum": [ "attachment" ], "description": "The kind of upload." }, "userId": { "type": "string", "format": "uuid", "description": "The identifier of the user the attachment is recorded against." }, "sourceType": { "type": "string", "nullable": true, "description": "Optional source or origin of the upload." } } }, "RegisterAttachmentResponse": { "type": "object", "additionalProperties": false, "properties": { "id": { "type": "integer", "format": "int32", "description": "The identifier of the newly registered attachment." }, "name": { "type": "string", "nullable": true, "description": "The name of the attachment, if set." } } } }, "securitySchemes": { "Bearer": { "type": "http", "scheme": "Bearer" } } } } ````