> For the complete documentation index, see [llms.txt](https://docufi3d.gitbook.io/docufi3d/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docufi3d.gitbook.io/docufi3d/api/documents.md).

# Documents

Operations related to document management

## POST /api/invite-for-sign

> Invite a user to sign a document

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"sanctum":[]}],"components":{"securitySchemes":{"sanctum":{"type":"http","description":"Enter the token in the format (Bearer <token>)","bearerFormat":"JWT","scheme":"bearer"}}},"paths":{"/api/invite-for-sign":{"post":{"tags":["Documents"],"summary":"Invite a user to sign a document","operationId":"2e78c03a612142687e0ff0ff1fdb98a2","requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["uuid","email"],"properties":{"uuid":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"firstname":{"type":"string"},"lastname":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number","format":"float"},"y":{"type":"number","format":"float"}},"type":"object"}}}},"responses":{"200":{"description":"Invitation email sent successfully","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"uuid":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"}},"type":"object"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"User or document not found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Upload a PDF document

> Allows authenticated users to upload a PDF document. The document is stored, and a thumbnail is generated.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/upload-document":{"post":{"tags":["Documents"],"summary":"Upload a PDF document","description":"Allows authenticated users to upload a PDF document. The document is stored, and a thumbnail is generated.","operationId":"16af6a70a598e23e118260fc7a456c30","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"required":["file"],"properties":{"file":{"description":"PDF document file (Only PDF format allowed)","type":"string","format":"binary"}},"type":"object"}}}},"responses":{"200":{"description":"Document uploaded successfully","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"url":{"type":"string","format":"url"},"uuid":{"type":"string","format":"uuid"}},"type":"object"}}}},"400":{"description":"No document uploaded","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"415":{"description":"Invalid file format","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Delete a document

> Allows authenticated users to delete a document by its UUID. If the document has not been signed, it is removed along with associated recipients and files.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/delete-document":{"delete":{"tags":["Documents"],"summary":"Delete a document","description":"Allows authenticated users to delete a document by its UUID. If the document has not been signed, it is removed along with associated recipients and files.","operationId":"300429cce91b66231df9bcd1d084ee64","parameters":[{"name":"uuid","in":"query","description":"The UUID of the document to be deleted","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Document removed successfully","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"uuid":{"type":"string","format":"uuid"}},"type":"object"}}}},"400":{"description":"Invalid request or missing UUID","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"403":{"description":"Document cannot be deleted as it is signed","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"Document not found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Download a signed document

> Allows authenticated users to download a signed document using its UUID.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/download-document":{"get":{"tags":["Documents"],"summary":"Download a signed document","description":"Allows authenticated users to download a signed document using its UUID.","operationId":"1c63064ec27ea82b3f5fefcbbe1ad967","parameters":[{"name":"uuid","in":"query","description":"The UUID of the signed document to be downloaded","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Signed document download","headers":{"Content-Disposition":{"description":"attachment; filename=document.pdf","schema":{"type":"string"}},"Content-Type":{"description":"application/pdf","schema":{"type":"string"}}}},"400":{"description":"Invalid request or missing UUID","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"Document not found or not signed","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## List all documents

> Retrieves a list of all documents belonging to the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/documents":{"get":{"tags":["Documents"],"summary":"List all documents","description":"Retrieves a list of all documents belonging to the authenticated user.","operationId":"f1a07916c6d51ec180fbfd24109a438c","responses":{"200":{"description":"Successful retrieval of documents","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"documents":{"type":"array","items":{"properties":{"id":{"type":"integer"},"uuid":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"type":"object"}}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"No document found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Get document status

> Retrieves the status of a specific document belonging to the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/documents/status":{"get":{"tags":["Documents"],"summary":"Get document status","description":"Retrieves the status of a specific document belonging to the authenticated user.","operationId":"fa601cf5ae5f7d35e9fdea046cd020bc","parameters":[{"name":"uuid","in":"query","description":"The UUID of the document.","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successful retrieval of document status","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"documents":{"type":"array","items":{"properties":{"id":{"type":"integer"},"uuid":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Missing UUID parameter","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"No document found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Check if a document is signed

> Checks whether a document associated with a given UUID and email has been signed.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/documents/signed_status":{"get":{"tags":["Documents"],"summary":"Check if a document is signed","description":"Checks whether a document associated with a given UUID and email has been signed.","operationId":"e7e87f0bb47105afd4b1d73aebf73406","parameters":[{"name":"uuid","in":"query","description":"The UUID of the document.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"email","in":"query","description":"The email address of the recipient.","required":true,"schema":{"type":"string","format":"email"}}],"responses":{"200":{"description":"Document signed status","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"}},"type":"object"}}}},"400":{"description":"Missing UUID parameter","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"Document not signed","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Send a reminder email to a recipient

> Sends a reminder email to a recipient for signing a document.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/documents/reminder":{"post":{"tags":["Documents"],"summary":"Send a reminder email to a recipient","description":"Sends a reminder email to a recipient for signing a document.","operationId":"45113c8036006021f37e47d8a2014e5e","requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["uuid","email"],"properties":{"uuid":{"description":"The UUID of the document.","type":"string","format":"uuid"},"email":{"description":"The email address of the recipient.","type":"string","format":"email"}},"type":"object"}}}},"responses":{"200":{"description":"Reminder email sent successfully","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"},"uuid":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"}},"type":"object"}}}},"400":{"description":"Missing or invalid parameters","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"User not authenticated","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"Document or recipient not found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```

## Sign a document

> Allows an authenticated user to sign a document by providing a valid UUID.

```json
{"openapi":"3.1.0","info":{"title":"API Documentation","version":"1.0.0"},"tags":[{"name":"Documents","description":"Operations related to document management"}],"servers":[{"url":"http://localhost:8000","description":"Local Development Server"},{"url":"https://docufi3d.com","description":"Production Server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{}},"paths":{"/api/sign_document":{"post":{"tags":["Documents"],"summary":"Sign a document","description":"Allows an authenticated user to sign a document by providing a valid UUID.","operationId":"signDocument","requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["uuid"],"properties":{"uuid":{"description":"Unique identifier of the document","type":"string"},"page":{"description":"Page number where the signature should be placed","type":"integer"},"x":{"description":"X-coordinate of the signature placement","type":"integer"},"y":{"description":"Y-coordinate of the signature placement","type":"integer"}},"type":"object"}}}},"responses":{"200":{"description":"Document signed successfully","content":{"application/json":{"schema":{"properties":{"success":{"type":"string"}},"type":"object"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"properties":{"error":{"type":"string"}},"type":"object"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docufi3d.gitbook.io/docufi3d/api/documents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
