Skip to main content

Locker API Quickstart

Upload a document and chat with it using AI in under 5 minutes.

Prerequisites

  • A Propper account with API access
  • API credentials from the dashboard

Step 1: Get an Access Token

Exchange your client credentials for an access token with locker scopes.

curl -X POST "https://auth.propper.ai/oauth2/token" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"scope": "locker:read locker:write"
}'

Response:

{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "locker:read locker:write"
}
tip

Tokens expire in 1 hour. Cache them and refresh before expiry.

Step 2: Upload a Document

Upload a document using multipart form data.

curl -X POST "https://api.propper.ai/v1/locker/documents/upload" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "file=@contract.pdf" \
-F "name=Service Agreement" \
-F "documentType=CONTRACT" \
-F "tags=legal,active"

Response:

{
"id": "d7f3a1b2-4c5e-6f7a-8b9c-0d1e2f3a4b5c",
"name": "Service Agreement",
"documentType": "CONTRACT",
"mimeType": "application/pdf",
"tags": ["legal", "active"],
"createdAt": "2024-01-15T10:00:00Z"
}

Step 3: Chat with the Document

Ask a question about the uploaded document.

curl -X POST "https://api.propper.ai/v1/locker/chat" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "What are the key terms of this agreement?",
"documentIds": ["d7f3a1b2-4c5e-6f7a-8b9c-0d1e2f3a4b5c"]
}'

Step 4: Stream a Chat Response

For longer answers, use the streaming endpoint for real-time responses.

curl -N -X POST "https://api.propper.ai/v1/locker/chat/stream" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "Summarize the obligations in this agreement",
"documentIds": ["d7f3a1b2-4c5e-6f7a-8b9c-0d1e2f3a4b5c"]
}'

Common Mistakes

Don't forget these

1. Missing document IDs in chat

// Wrong - no documents to query
{ message: "What are the terms?" }

// Correct - specify which documents to chat with
{ message: "What are the terms?", documentIds: ["d7f3a1b2-..."] }

2. Exceeding file size limit

The maximum upload size is 50 MB. For larger files, split them into smaller documents.

3. Using wrong scope

# Wrong - read scope can't upload documents
scope: "locker:read"

# Correct - write scope needed for uploads
scope: "locker:read locker:write"

What's Next?