GitLaw Public API Reference
Build custom integrations with the GitLaw Public API. Connect GitLaw to any system — your internal tools, Make, n8n, Pipedream, or anything else that can make HTTP requests.
Prefer no-code? Use our Zapier integration instead.
Overview
The GitLaw Public API lets external services trigger contract generation and document analysis. Send a request, and the API processes it and returns the result directly in the response.
What you can do:
- Generate contracts and legal documents via AI
- Analyze existing documents by referencing a file already in GitLaw
- Upload new files for analysis by including base64-encoded content
- Continue existing chat conversations or start new ones
Authentication
All API requests require an API key passed via the X-API-Key header:
X-API-Key: YOUR_API_KEY
Generate API keys in your GitLaw account settings. The full key is shown only once at creation — store it securely.
API Endpoint
POST /public-api/v1/chat/ask
Send a message to generate or analyze a contract.
Request Body
{
"message": "Create an NDA between Acme Corp and Beta Inc",
"fileId": "file-123",
"fileContent": "base64...",
"fileName": "doc.docx",
"chatId": "chat-456"
}
Parameters
File Handling Rules
- You can provide
fileId,fileContent+fileName, or neither — but not bothfileIdandfileContent - If both
fileIdandfileContentare provided, the request is rejected with a400 Bad Requesterror - If
fileContentis provided,fileNamemust also be included (and vice versa) - Use
fileIdfor files already in GitLaw - Use
fileContent+fileNameto upload a new file with your request
Response
The API processes the request and returns the result directly.
Success Response
{
"chatId": "chat_456",
"answer": "I've created an NDA between Acme Corp and Beta Inc...",
"fileId": "file_789",
"documentContent": "base64..."
}
Example: Create a Contract
Request
curl -X POST https://api.git.law/public-api/v1/chat/ask \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Create an NDA between Acme Corp and Beta Inc"
}'
Response
{
"chatId": "chat_456",
"answer": "I've created an NDA between Acme Corp and Beta Inc...",
"fileId": "file_789",
"documentContent": "UEsDBBQAAAAI..."
}
Example: Analyze an Existing Document
Request
curl -X POST https://api.git.law/public-api/v1/chat/ask \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Review this contract and identify any problematic clauses",
"fileId": "file_existing_789"
}'
Response
{
"chatId": "chat_123",
"answer": "I've reviewed the contract. Here are the key issues I identified:\n\n1. The liability clause in Section 4.2 is unusually broad...",
"fileId": "file_existing_789"
}
Example: Upload and Analyze a New File
Request
curl -X POST https://api.git.law/public-api/v1/chat/ask \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Summarize this contract",
"fileContent": "UEsDBBQAAAAI...",
"fileName": "vendor-agreement.docx"
}'
Response
{
"chatId": "chat_789",
"answer": "Here is a summary of the vendor agreement...",
"fileId": "file_new_456",
"documentContent": "UEsDBBQAAAAI..."
}
Example: Continue a Conversation
Request
curl -X POST https://api.git.law/public-api/v1/chat/ask \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chatId": "chat_456",
"message": "Now add a non-compete clause to the NDA"
}'
Response
{
"chatId": "chat_456",
"answer": "I've added a non-compete clause to the NDA...",
"fileId": "file_789",
"documentContent": "UEsDBBQAAAAI..."
}
Error Handling
Common Errors
Best Practices
- Store your API key securely — It is shown only once at creation and cannot be recovered
- Use
chatIdto continue conversations — This preserves context from previous messages, producing better results - Prefer
fileIdfor existing files — Avoid re-uploading files that are already in GitLaw - Handle errors gracefully — Check HTTP status codes and parse error responses
- Respect rate limits — Back off when you receive a
429response
Questions?
If you encounter issues:
- Verify your API key is valid and not expired
- Ensure all required parameters are provided
- Check that
fileIdandfileContentare not used together - Contact GitLaw support if problems persist