REST API attachment upload fails with 415 Unsupported Media Type for contract documents

We’re automating contract document uploads but consistently getting 415 Unsupported Media Type errors when posting attachments via the REST API. Our integration uploads PDF contract documents to existing contract records:


POST /fscmRestApi/resources/11.13.18.05/contracts/{contractId}/child/Attachments
Content-Type: multipart/form-data

We’ve tested with PDF, DOCX, and XLSX files - all return 415 errors. The API documentation mentions supported attachment upload formats but doesn’t specify Content-Type header requirements clearly. We’re using standard multipart/form-data encoding with the file in the ‘UploadedFile’ field. Has anyone successfully implemented contract attachment uploads? What Content-Type configuration works?

Check your multipart boundary formatting. The boundary string must be unique and match exactly between the Content-Type header and the part separators in the body. Also, Oracle Fusion requires the JsonData part before the UploadedFile part in the multipart body. Order matters.

Here’s the complete solution covering all three focus areas:

Attachment Upload Formats: Oracle Fusion Cloud supports these file formats for contract attachments: PDF, DOCX, XLSX, PPTX, TXT, PNG, JPG, and ZIP. However, the MIME type must match exactly:

  • PDF: application/pdf
  • Word: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Images: image/png, image/jpeg

Avoid using generic application/octet-stream - it triggers 415 errors even for valid files.

Content-Type Header Requirements: The multipart/form-data request requires precise formatting:


POST /fscmRestApi/resources/11.13.18.05/contracts/{contractId}/child/Attachments
Content-Type: multipart/form-data; boundary=----Boundary123456

------Boundary123456
Content-Disposition: form-data; name="JsonData"
Content-Type: application/json

{"FileName":"Contract_Terms.pdf","Title":"Contract Terms","CategoryName":"CONTRACTS","DatatypeCode":"FILE"}
------Boundary123456
Content-Disposition: form-data; name="UploadedFile"; filename="Contract_Terms.pdf"
Content-Type: application/pdf

[binary PDF content]
------Boundary123456--

Critical requirements:

  1. JsonData MUST come before UploadedFile
  2. Boundary must be unique and match in header and body
  3. FileName in JsonData must match filename in Content-Disposition
  4. CategoryName must be valid for contracts (use ‘CONTRACTS’ or ‘MISCELLANEOUS’)
  5. File extension must match Content-Type

API Documentation Gaps: The official documentation omits several mandatory fields and behaviors:

  1. Undocumented Required Fields:

    • Title field is mandatory despite docs marking it optional
    • DatatypeCode defaults to ‘FILE’ but must be explicit for reliability
    • CategoryName must exist in attachment categories setup
  2. Size Limitations:

    • Individual files: 100MB maximum (not documented)
    • Total attachments per contract: 500MB (undocumented)
    • Exceeding limits returns 415 instead of 413
  3. Character Encoding:

    • Filename must be UTF-8 encoded
    • Special characters in filename require URL encoding
    • Spaces should be replaced with underscores
  4. Authentication:

    • OAuth token must have ‘Manage Contract Attachments’ privilege
    • Basic auth works but OAuth recommended for production

Testing Approach: Validate your implementation by:

  1. Test with small PDF (< 1MB) first
  2. Verify JsonData structure independently via JSON validator
  3. Use curl or Postman to isolate client library issues
  4. Enable full HTTP logging to see actual headers sent
  5. Compare working UI upload with API request structure

Common mistake: Using HTTP libraries that auto-generate boundaries can create invalid formats. Manually construct the multipart body or use libraries specifically tested with Oracle Fusion (OkHttp for Java, requests-toolbelt for Python).

Have you verified that your contract record allows attachments? Some contract types have attachment restrictions configured at the setup level. Also check the DatatypeCode in your JsonData part - it should match allowed attachment categories for contracts (typically ‘FILE’ or ‘WEB_PAGE’).

The 415 error indicates the API isn’t recognizing your Content-Type. For Oracle Fusion attachments, you need to use a very specific multipart structure. Make sure you’re setting the boundary parameter correctly in the Content-Type header and that each part has its own Content-Disposition header.

We struggled with this for weeks. The issue is that Oracle expects the Content-Type for the file part to match the actual file type, not just generic application/octet-stream. For PDFs use application/pdf, for Word docs use application/vnd.openxmlformats-officedocument.wordprocessingml.document. Also ensure the filename in Content-Disposition includes the correct extension.