company logo

Help center

Go to Agentcis
Follow us on FacebookFollow us on Linkedin
All collectionsAPI DocumentationDocuments (Attachment) API Documentation

Documents (Attachment) API Documentation

The Attachment API provides endpoints for managing file attachments across different entities in the system (clients, applications, tasks, partners, etc.). It supports polymorphic relationships, allowing attachments to be associated with various types of entities.

Attachment Base URL:

https://{tenant-domain}.agentcis.com/api/v2/attachments/{attachmentableType}/{attachmentableId}

Parameters:

- attachmentableType (path parameter): The type of entity (e.g. clien,applications=>document_checklis,task,partner`)

- attachmentableId (path parameter): The ID of the entity

                    



API Endpoints

List Attachments 🔒

  • Endpoint:{{Attachment Base URL}}/

  • Method: GET

  • Description: Retrieves all documents for a specific entity type and ID  

Query String Parameters:

per_page=10&page=1


Response:

{

  "data": [

  {

            "_links": {

                "preview": "https:\/\/demoagency.agentcisapp.com\/attachments\/3\/preview",

                "download": "https:\/\/demoagency.agentcisapp.com\/attachments\/3\/download"

            },

            "id": 3,

            "original_name": "John.docx",

            "type": "docx",

            "namespace": "default",

            "file_size": {

                "formatted": "11.56 KB",

                "actual": 11839

            },

            "meta": null,

            "created_at": "05-02-2018",

            "updated_at": "01-31-2019",

            "uploaded_by": []

        },


  ],

  "links": {

        "first": "http:\/\/demoagency.agentcisapp.com\/api\/v2\/attachments\/client\/5?page=1",

        "last": "http:\/\/demoagency.agentcisapp.com\/api\/v2\/attachments\/client\/5?page=1",

        "prev": null,

        "next": null

    },

    "meta": {

        "current_page": 1,

        "from": 1,

        "last_page": 1,

        "links": [

            {

                "url": null,

                "label": "« Previous",

                "active": false

            },

            {

   "url": "http:\/\/demoagency.agentcisapp.com\/api\/v2\/attachments\/client\/5?page=1",

                "label": "1",

                "active": true

            },

            {

                "url": null,

                "label": "Next »",

                "active": false

            }

        ],

        "path": "http:\/\/demoagency.agentcisapp.com\/api\/v2\/attachments\/client\/5",

        "per_page": "10",

        "to": 2,

        "total": 2

    }

}


HTTP Status Codes:

- 200 OK: Success

- 401 Unauthorized: Invalid or missing authentication

- 403 Forbidden: Insufficient permissions

- 404 Not Found: Entity not found

Uploads Attachments 🔒

  • Endpoint: {{Attachment Base URL}}/

  • Method: POST

  • Description: Uploads documents for a specific entity type and ID  

Payload:

{

  "documents": [] (binary)

}


Note: use body type as form-data and set key as file

Response:

{

    "uploadedFiles": [],

    "rejectedFiles": [

        {

            "original_name": “",

            "path":””,

            "type": "pdf",

            "description": "",

            "file_size": ,

            "namespace": "”,

            "givenName": ""

        }

    ]

}


HTTP Status Codes:

- 200 OK: Success

- 400 Bad Request: Validation error

- 401 Unauthorized: Invalid or missing authentication

- 403 Forbidden: Insufficient permissions

- 404 Not Found: Entity not found

- 413 Payload Too Large: File size exceeds limit

Update Attachments 🔒

  • Endpoint: {{Attachment Base URL}}/

  • Method: PUT

  • Description: Updates documents for a specific entity type and ID  

Payload:

{

    original_name: “John”,

}

Response:

{

    "data": {

        "id": 3,

        "original_name": "Johns.docx",

        "path": "uploads\/documents\/c099688968925528594d8e5a2d9f3aaf.docx",

        "type": "docx",

        "description": null,

        "uploader": null,

        "uploader_type": "user",

        "attachmentable_id": 5,

        "attachmentable_type": "client",

        "file_size": 11839,

        "created_at": "2018-05-02T01:29:07.000000Z",

        "updated_at": "2025-10-08T08:56:38.000000Z",

        "namespace": "default",

        "meta": null

    },

    "message": "You\u2019ve successfully saved your attachment\u2019s information."

}


HTTP Status Codes:

- 200 OK: Success

- 400 Bad Request: Validation error

- 401 Unauthorized: Invalid or missing authentication

- 403 Forbidden: Insufficient permissions

- 404 Not Found: Entity not found

Show Attachment 🔒

  • Endpoint:{{Base URL}}/attachments/view/{attachmentId}/download

  • Method: GET

  • Description: Shows the details of the specific attachment.

Response:

{

   "id": 12443,

   "original_name": "Your Agent Agreement with Nova Anglia College_Study Network Pty Ltd.pdf",

   "path": "uploads/partner/attachments/a00fe21fb68725ade4bdbe845a9fd5a2.pdf",

   "type": "pdf",

   "file_size": 547967,

   "description": "",

   "namespace": "default",

   "url": "https://agentcisapp.s3.ap-southeast-2.amazonaws.com/3ccc6d9e-927f-4d30-b667-2a24c82de576/uploads/partner/attachments/a00fe21fb68725ade4bdbe845a9fd5a2.pdf?response-content-disposition=attachment%3B%20filename%3D%22Your%20Agent%20Agreement%20with%20Nova%20Anglia%20College_Study%20Network%20Pty%20Ltd.pdf%22&response-content-type=application%2Fpdf&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJDQV36DNJQCY2VQA%2F20260204%2Fap-southeast-2%2Fs3%2Faws4_request&X-Amz-Date=20260204T082853Z&X-Amz-SignedHeaders=host&X-Amz-Expires=15&X-Amz-Signature=94ab84fce1bb4480dcced3003f8796804a37b2731e75b67fc03d508cd87d8ee1",

   "action": "download"

 }

HTTP Status Codes:

- 200 OK: Success

Delete Attachments 🔒

  • Endpoint:{{Base URL}}/attachments

  • Method: POST

  • Description: Deletes multiple documents.

Payload:

{

     ids: [100, 101],

      _method: "delete"

}

Response:

{

    “deletedFile”:[],

    “rejectedFiles”:[]

 }


HTTP Status Codes:

- 200 OK: Success

- 400 Bad Request: Validation error

- 401 Unauthorized: Invalid or missing authentication

- 403 Forbidden: Insufficient permissions

Did this answer your question?
😞
😐
😁