Document Management API
The Document Management API allows you to manage documents and files in your TaskIP CRM system. You can upload, organize, share, and track documents with version control, access permissions, and collaboration features.
Endpoints Overview
Method | Endpoint | Description |
---|---|---|
GET | /api/public-v1/document | Get all documents |
POST | /api/public-v1/document | Upload a new document |
GET | /api/public-v1/document/{id} | Get a specific document |
PUT | /api/public-v1/document/{id} | Update document metadata |
DELETE | /api/public-v1/document/{id} | Delete a document |
GET | /api/public-v1/document/{id}/download | Download document file |
Get All Documents
Retrieve a list of all documents in your system.
GET /api/public-v1/document
Request Headers
X-Secret-Key: your-secret-key-here
Content-Type: application/json
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
page | integer | No | Page number for pagination (default: 1) |
limit | integer | No | Number of documents per page (default: 50) |
search | string | No | Search term for document name or content |
sort | string | No | Sort field (name , size , created_at , updated_at ) |
order | string | No | Sort order (asc or desc ) |
folder_id | integer | No | Filter by folder ID |
file_type | string | No | Filter by file type (pdf , doc , image , spreadsheet ) |
owner_id | integer | No | Filter by document owner |
shared_with_me | boolean | No | Show only documents shared with current user |
date_from | string | No | Filter documents from date (YYYY-MM-DD) |
date_to | string | No | Filter documents to date (YYYY-MM-DD) |
Example Request
curl -X GET "https://public-api.taskip.net/api/public-v1/document?page=1&limit=20&folder_id=5&file_type=pdf" \
-H "X-Secret-Key: your-secret-key-here" \
-H "Content-Type: application/json"
JavaScript Example
const response = await fetch('https://public-api.taskip.net/api/public-v1/document?page=1&limit=20', {
method: 'GET',
headers: {
'X-Secret-Key': 'your-secret-key-here',
'Content-Type': 'application/json'
}
});
const documents = await response.json();
Example Response
{
"status": 200,
"data": [
{
"id": 1,
"uuid": "doc_abc123def456",
"created_by": {
"id": 3,
"name": "Sarah Johnson",
"image": {
"id": 15,
"original_url": "https://storage.googleapis.com/files/profile.jpg"
},
"type": "user",
"email": "sarah@company.com",
"contact_id": null
},
"folder": {
"id": 5,
"uuid": "folder_xyz789",
"name": "Proposals"
},
"name": "Project Proposal - Acme Corp",
"visibility": {
"id": 1,
"label": "Team"
},
"permissions": [
{
"id": 1,
"document_id": 1,
"user_id": 8,
"access_type": 2,
"user": {
"name": "David Chen",
"image": {
"id": 20,
"original_url": "https://storage.googleapis.com/files/david.jpg"
},
"type": "user",
"email": "david@company.com",
"contact_id": null
}
}
],
"created_at": "Jan 15, 2024, 9:30 AM",
"access": "Owner",
"publish": null,
"teams": []
},
{
"id": 2,
"uuid": "doc_ghi789jkl012",
"created_by": {
"id": 5,
"name": "Mike Wilson",
"image": {
"id": 25,
"original_url": "https://storage.googleapis.com/files/mike.jpg"
},
"type": "user",
"email": "mike@company.com",
"contact_id": null
},
"folder": {
"id": 8,
"uuid": "folder_def456",
"name": "Templates"
},
"name": "Contract Template",
"visibility": {
"id": 2,
"label": "Public"
},
"permissions": [],
"created_at": "Jan 10, 2024, 11:15 AM",
"access": "View",
"publish": "https://workspace.taskip.net/document/contract-template-abc123",
"teams": []
}
]
}
Upload a New Document
Upload a new document to your system.
POST /api/public-v1/document
Request Headers
X-Secret-Key: your-secret-key-here
Content-Type: multipart/form-data
Request Body
Field | Type | Required | Description |
---|---|---|---|
name | string | Yes | Document name (max 191 characters) |
visibility | integer | Yes | Visibility level (0=Private, 1=Team, 2=Public) |
folder_id | string | No | UUID of folder to place document in |
Example Request
curl -X POST "https://public-api.taskip.net/api/public-v1/document" \
-H "X-Secret-Key: your-secret-key-here" \
-H "Content-Type: application/json" \
-d '{
"name": "Project Requirements - TechCorp",
"visibility": 1,
"folder_id": "folder_xyz789"
}'
JavaScript Example
const response = await fetch('https://public-api.taskip.net/api/public-v1/document', {
method: 'POST',
headers: {
'X-Secret-Key': 'your-secret-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Project Requirements - TechCorp',
visibility: 1,
folder_id: 'folder_xyz789'
})
});
const result = await response.json();
Example Response
{
"status": 200,
"msg": "Document Created Successfully",
"document": {
"id": 126,
"uuid": "doc_mno345pqr678",
"created_by": {
"id": 3,
"name": "Current User",
"image": {
"id": 30,
"original_url": "https://storage.googleapis.com/files/current-user.jpg"
},
"type": "user",
"email": "current@company.com",
"contact_id": null
},
"folder": {
"id": 5,
"uuid": "folder_xyz789",
"name": "Proposals"
},
"name": "Project Requirements - TechCorp",
"visibility": {
"id": 1,
"label": "Team"
},
"permissions": [],
"created_at": "Jan 20, 2024, 10:30 AM",
"access": "Owner",
"publish": null,
"teams": []
}
}
Get a Specific Document
Retrieve details of a specific document by ID.
GET /api/public-v1/document/{id}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | integer | Yes | Document ID |
Example Request
curl -X GET "https://public-api.taskip.net/api/public-v1/document/126" \
-H "X-Secret-Key: your-secret-key-here" \
-H "Content-Type: application/json"
Example Response
{
"success": true,
"data": {
"id": 126,
"name": "Project Requirements - TechCorp",
"original_filename": "project-requirements.pdf",
"file_type": "pdf",
"file_size": 1572864,
"mime_type": "application/pdf",
"folder_id": 5,
"folder": {
"id": 5,
"name": "Proposals",
"path": "/Documents/Proposals"
},
"owner_id": 3,
"owner": {
"id": 3,
"name": "Sarah Johnson",
"email": "sarah@company.com"
},
"description": "Detailed requirements document for TechCorp project",
"tags": ["requirements", "project", "techcorp"],
"version": "1.0",
"is_public": false,
"download_count": 8,
"file_hash": "sha256:abc123def456...",
"permissions": {
"can_view": true,
"can_edit": true,
"can_delete": true,
"can_share": true
},
"shared_with": [
{
"user_id": 8,
"user_name": "David Chen",
"permission": "edit",
"shared_at": "2024-01-20T11:00:00Z"
}
],
"recent_activity": [
{
"action": "downloaded",
"user": "Mike Wilson",
"timestamp": "2024-01-21T09:15:00Z"
},
{
"action": "shared",
"user": "Sarah Johnson",
"details": "Shared with David Chen",
"timestamp": "2024-01-20T11:00:00Z"
}
],
"created_at": "2024-01-20T10:30:00Z",
"updated_at": "2024-01-20T10:30:00Z"
}
}
Update Document Metadata
Update an existing document's metadata (name, description, etc.).
PUT /api/public-v1/document/{id}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | integer | Yes | Document ID to update |
Request Body
Field | Type | Required | Description |
---|---|---|---|
name | string | No | Document name |
description | string | No | Document description |
folder_id | integer | No | Move to different folder |
tags | array | No | Array of tags |
is_public | boolean | No | Public access setting |
Example Request
curl -X PUT "https://public-api.taskip.net/api/public-v1/document/126" \
-H "X-Secret-Key: your-secret-key-here" \
-H "Content-Type: application/json" \
-d '{
"name": "Project Requirements - TechCorp (Updated)",
"description": "Updated requirements document with latest changes",
"tags": ["requirements", "project", "techcorp", "updated"]
}'
Example Response
{
"success": true,
"message": "Document updated successfully",
"data": {
"id": 126,
"name": "Project Requirements - TechCorp (Updated)",
"description": "Updated requirements document with latest changes",
"tags": ["requirements", "project", "techcorp", "updated"],
"created_at": "2024-01-20T10:30:00Z",
"updated_at": "2024-01-21T14:15:00Z"
}
}
Delete a Document
Delete a specific document from your system.
DELETE /api/public-v1/document/{id}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | integer | Yes | Document ID to delete |
Warning: Deleting a document will permanently remove the file and all associated metadata, versions, and comments. This action cannot be undone.
Example Request
curl -X DELETE "https://public-api.taskip.net/api/public-v1/document/126" \
-H "X-Secret-Key: your-secret-key-here"
Example Response
{
"msg": "Document deleted successfully",
"status": 200
}
Download Document File
Download the actual document file.
GET /api/public-v1/document/{id}/download
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | integer | Yes | Document ID to download |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
version | string | No | Specific version to download (defaults to latest) |
Example Request
curl -X GET "https://public-api.taskip.net/api/public-v1/document/125/download" \
-H "X-Secret-Key: your-secret-key-here" \
-O -J
JavaScript Example (with Blob)
const response = await fetch('https://public-api.taskip.net/api/public-v1/document/125/download', {
method: 'GET',
headers: {
'X-Secret-Key': 'your-secret-key-here'
}
});
if (response.ok) {
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'document.pdf';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
}
Response
The response will be a PDF file generated from the document content with appropriate headers:
Content-Type: application/pdf
Content-Disposition: attachment; filename="document-name.pdf"
The Laravel backend generates the PDF using:
return pdf()
->margins(top: 20, right: 20, bottom: 10, left: 20)
->format('a4')
->landscape(false)
->view('document::PDF.template', compact('content', 'title'))
->name($pdName);
Error Responses
Common Error Codes
Status Code | Error Type | Description |
---|---|---|
400 | Bad Request | Invalid request data or missing required fields |
401 | Unauthorized | Invalid or missing X-Secret-Key |
403 | Forbidden | Insufficient permissions to access document |
404 | Not Found | Document not found |
409 | Conflict | Document name already exists in folder |
413 | Payload Too Large | File size exceeds limit |
422 | Validation Error | Request data failed validation |
429 | Too Many Requests | Rate limit exceeded |
Example Error Response
{
"success": false,
"error": "Validation Error",
"message": "The given data was invalid",
"errors": {
"file": ["The file field is required."],
"folder_id": ["The selected folder id is invalid."],
"name": ["The name may not be greater than 255 characters."]
},
"status_code": 422
}
Response Schemas
Document Object
{
"id": "integer",
"name": "string",
"original_filename": "string",
"file_type": "string",
"file_size": "integer",
"mime_type": "string",
"folder_id": "integer|null",
"folder_name": "string|null",
"owner_id": "integer",
"owner_name": "string",
"description": "string|null",
"tags": "array",
"version": "string",
"is_public": "boolean",
"download_count": "integer",
"file_hash": "string",
"shared_with": "array",
"created_at": "string (ISO 8601)",
"updated_at": "string (ISO 8601)"
}
Folder Object
{
"id": "integer",
"name": "string",
"parent_id": "integer",
"path": "string",
"document_count": "integer",
"subfolders": "array",
"created_at": "string (ISO 8601)",
"updated_at": "string (ISO 8601)"
}
Comment Object
{
"id": "integer",
"comment": "string",
"author": "string",
"author_id": "integer",
"is_private": "boolean",
"mentions": "array",
"replies": "array",
"created_at": "string (ISO 8601)"
}
Best Practices
Document Organization
- Folder structure: Create a logical folder hierarchy for better organization
- Naming conventions: Use consistent, descriptive file names
- Tagging strategy: Implement a standardized tagging system for easy discovery
- Version control: Use version notes to document changes between versions
Security & Access Control
- Permission management: Set appropriate permissions for document sharing
- Expiration dates: Use expiration dates for temporary document sharing
- Private comments: Use private comments for internal notes and feedback
- Access monitoring: Monitor document access and download activity
Storage Management
- File size limits: Keep file sizes reasonable for better performance
- Regular cleanup: Archive or delete outdated documents
- Storage monitoring: Monitor storage usage and plan for capacity
- Duplicate prevention: Check for duplicate files before uploading
Tip: Use the search endpoint with content indexing to find documents based on their actual content, not just filenames. This is particularly useful for finding information within PDFs and Word documents.