Files

Upload and manage documents within your projects.

Supported File Types

TypeFormatsProcessing
PDF.pdfAuto-extracted to text
Images.png, .jpg, .jpeg, .gif, .webpClaude Vision API
Text.txt, .md, .csv, .jsonRead directly

Note: Images are analyzed visually using Claude's native vision API. This enables OCR, chart reading, and visual content analysis.

Upload File

POST /api/files/upload?projectId=proj_abc123&filename=document.pdf
Content-Type: application/octet-stream

Query Parameters

ParameterRequiredDescription
projectIdYesTarget project ID
filenameYesName of the file
pathNoRelative path (e.g., reports/2024/file.pdf)

Example - cURL

curl -X POST \
  "https://api.getneji.com/api/files/upload?projectId=proj_abc123&filename=report.pdf" \
  -H "Authorization: Bearer sk_your_key" \
  -H "Content-Type: application/pdf" \
  --data-binary @report.pdf

Example - JavaScript

const response = await fetch(
  'https://api.getneji.com/api/files/upload?projectId=proj_abc123&filename=document.pdf',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_key',
      'Content-Type': 'application/pdf',
    },
    body: file,
  }
);

Example - Python

import requests

with open('document.pdf', 'rb') as f:
    response = requests.post(
        'https://api.getneji.com/api/files/upload',
        params={'projectId': 'proj_abc123', 'filename': 'document.pdf'},
        headers={
            'Authorization': 'Bearer sk_your_key',
            'Content-Type': 'application/pdf'
        },
        data=f
    )

Response

{
  "success": true,
  "fileId": "file_xyz789",
  "filename": "document.pdf",
  "size": 1048576,
  "path": "document.pdf"
}

List Files

GET /api/files/projects/:projectId/files

Response

{
  "success": true,
  "files": [
    {
      "fileId": "file_xyz789",
      "filename": "document.pdf",
      "size": 1048576,
      "mimeType": "application/pdf",
      "uploadedAt": 1699999999999,
      "extractionStatus": "completed"
    }
  ]
}

Extraction Status Values

StatusDescription
completedPDF text extracted, ready for analysis
pendingPDF queued for extraction
not_applicableNon-PDF file (ready immediately)

Tip: Wait for extractionStatus: "completed" before analyzing newly uploaded PDFs.

Download File

GET /api/files/:fileId/download

Delete File

DELETE /api/files/:fileId