Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CodexaCP/SERVICIOS-BACK/llms.txt

Use this file to discover all available pages before exploring further.

The ServiciosYa API accepts file uploads at four distinct endpoints, each serving a different point in the service-request lifecycle. Files are saved to the wwwroot/uploads/ directory on the server’s local disk and served as static files. Every upload endpoint enforces a hard 10 MB limit and requires a valid Bearer token. The URL or path returned by each endpoint must be stored by the client and referenced in subsequent API calls.

Overview

Payment Proof

Upload before creating a request. The returned imageUrl is required when calling POST /api/servicerequests.

Service Attachment

Optional extra file attached to an existing request. Only allowed when the service has PermiteAdjunto = 1.

Invoice

Admin-only. Attach a PDF or image invoice to a completed or in-progress request.

Delivery Attachment

Gestor-level and above. Attach proof of delivery (PDF, image, or WebP) to a request.
All upload endpoints store files on the server’s local disk under wwwroot/uploads/. In a horizontally scaled or containerised deployment this directory will not be shared between instances. For production environments with more than one API node, mount a shared volume or migrate file storage to an object-storage service (e.g. Azure Blob Storage, AWS S3) and update the path logic in UploadsController and ServiceRequestsController.

1. Payment Proof Upload

Every service request requires a payment proof image. Upload the image first, then pass the returned imageUrl to POST /api/servicerequests.
EndpointPOST /api/uploads/payment
AuthBearer token required (any authenticated role)
Content-Typemultipart/form-data
Max size10 MB
Accepted MIME typesimage/jpeg, image/png, image/jpg
Accepted extensions.jpg, .jpeg, .png
Request Send the file in a field named file:
curl -X POST https://api.example.com/api/uploads/payment \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/receipt.jpg"
Response 200 OK
{
  "imageUrl": "https://api.example.com/uploads/a3f82c1d-9e4b-4d0a-b7e2-1234567890ab.jpg"
}
The file is renamed to a random UUID on disk. The original filename is not preserved in the URL but is captured in the PRO audit log (OriginalFileName change field).

2. Service Request Attachment

After a service request has been created, an optional supplementary file can be attached. The service must have been configured with PermiteAdjunto = 1; attempting to attach a file to a request for a service without this flag will return 400 with the message "Este servicio no permite adjuntos.".
EndpointPOST /api/servicerequests/{id}/attachment
AuthBearer token required (any authenticated role)
Content-Typemultipart/form-data
Max size10 MB
Accepted typesAny file type (no MIME restriction at the API layer)
Request
curl -X POST https://api.example.com/api/servicerequests/42/attachment \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/document.pdf"
Response 200 OK
{
  "attachmentId": 123
}
Only one attachment is allowed per service request. A second upload attempt returns 400 with "Ya existe un adjunto para esta solicitud.".

3. Invoice Upload

Administrators attach an invoice after a request has been processed. This endpoint is restricted to privileged roles.
EndpointPOST /api/servicerequests/{id}/invoice
AuthSUPER_ADMIN, ADMIN_GENERAL, or GESTOR_SUPREMO
Content-Typemultipart/form-data
Max size10 MB
Accepted extensions.pdf, .png, .jpg, .jpeg
Request
curl -X POST https://api.example.com/api/servicerequests/42/invoice \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/invoice.pdf"
Response 200 OK
{
  "invoiceUrl": "/uploads/service-requests/9b1c2e3a-4f5d-4a6b-8c7d-0e1f2a3b4c5d_invoice.pdf"
}
The invoiceUrl is a root-relative path. Prefix it with the API base URL to build the full download link.

4. Delivery Attachment

Gestores (and above) attach a delivery document once the service has been fulfilled — for example, a signed receipt or a photo of the completed work.
EndpointPOST /api/servicerequests/{id}/delivery-attachment
AuthSUPER_ADMIN, ADMIN_GENERAL, GESTOR_SUPREMO, or GESTOR
Content-Typemultipart/form-data
Max size10 MB
Accepted extensions.pdf, .png, .jpg, .jpeg, .webp
Request
curl -X POST https://api.example.com/api/servicerequests/42/delivery-attachment \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/delivery-proof.webp"
Response 200 OK
{
  "deliveryAttachmentUrl": "/uploads/service-requests/7d8e9f0a-1b2c-3d4e-5f6a-7b8c9d0e1f2a_delivery-proof.webp"
}

Typical service-request file flow

1

Upload payment proof

POST /api/uploads/payment → capture imageUrl.
2

Create service request

POST /api/servicerequests with imageUrl in the body.
3

Attach optional document (if PermiteAdjunto = 1)

POST /api/servicerequests/{id}/attachment.
4

Admin validates payment

PUT /api/servicerequests/{id}/payment.
5

Admin attaches invoice (if required)

POST /api/servicerequests/{id}/invoice.
6

Gestor attaches delivery proof

POST /api/servicerequests/{id}/delivery-attachment.

Error responses

HTTP StatusCause
400Missing file, file too large, unsupported MIME type or extension
400Service does not allow attachments (PermiteAdjunto = 0)
400Attachment already exists for this request
401Missing or invalid Bearer token
403Authenticated user’s role is not permitted for this endpoint

Storage location

Files are written to the following paths relative to wwwroot/:
Upload typeDirectory
Payment proofswwwroot/uploads/
Service attachmentswwwroot/uploads/service-requests/
Invoiceswwwroot/uploads/service-requests/
Delivery attachmentswwwroot/uploads/service-requests/
The directory is created automatically if it does not exist. Static-file middleware serves everything under wwwroot/ at the root URL, so a file saved as wwwroot/uploads/abc.jpg is accessible at https://host/uploads/abc.jpg.

Build docs developers (and LLMs) love