Skip to main content

Overview

The Core Projects API is a RESTful API built with Laravel that provides programmatic access to all construction management features. Use this API to manage projects, properties, sales, employees, and more.

Base URL

https://your-domain.com/api
All API endpoints are prefixed with /api. Replace your-domain.com with your actual application domain.

RESTful Conventions

The API follows standard REST principles:
  • GET - Retrieve resources
  • POST - Create new resources
  • PUT - Update existing resources (full update)
  • PATCH - Partially update existing resources
  • DELETE - Remove resources

Request Format

All requests should include the appropriate headers:
Content-Type: application/json
Accept: application/json
Authorization: Bearer {token}

Common Headers

Content-Type
string
required
Must be set to application/json for all requests with a body
Accept
string
required
Must be set to application/json to receive JSON responses
Authorization
string
required
Bearer token obtained from authentication endpoint. Format: Bearer {token}

Response Format

All API responses are returned in JSON format with a consistent structure.

Success Response

{
  "success": true,
  "data": {
    // Resource data
  },
  "message": "Operation completed successfully"
}
success
boolean
required
Indicates whether the request was successful
data
object
required
Contains the requested resource(s) or operation result
message
string
Optional message describing the operation result

Error Response

{
  "success": false,
  "errors": {
    "field_name": [
      "Error message for this field"
    ]
  },
  "message": "Validation failed"
}
success
boolean
required
Always false for error responses
errors
object
Object containing field-specific validation errors
message
string
General error message

HTTP Status Codes

The API uses standard HTTP status codes:
CodeDescription
200OK - Request successful
201Created - Resource created successfully
204No Content - Request successful with no response body
400Bad Request - Invalid request format
401Unauthorized - Authentication required or failed
403Forbidden - Insufficient permissions
404Not Found - Resource not found
422Unprocessable Entity - Validation failed
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error occurred

Error Handling

Validation Errors (422)

When validation fails, the API returns a 422 status code with detailed field errors:
{
  "success": false,
  "errors": {
    "nombre": [
      "El nombre del proyecto es obligatorio"
    ],
    "email": [
      "El email debe ser válido"
    ]
  }
}

Authentication Errors (401)

{
  "message": "Unauthenticated."
}

Authorization Errors (403)

{
  "message": "No tienes permiso para acceder a esta sección."
}

Resource Not Found (404)

{
  "success": false,
  "message": "Recurso no encontrado"
}

Pagination

List endpoints support pagination for large datasets. Paginated responses include metadata:
{
  "success": true,
  "data": [
    // Array of resources
  ],
  "meta": {
    "current_page": 1,
    "per_page": 15,
    "total": 100,
    "last_page": 7
  },
  "links": {
    "first": "https://api.example.com/recursos?page=1",
    "last": "https://api.example.com/recursos?page=7",
    "prev": null,
    "next": "https://api.example.com/recursos?page=2"
  }
}

Pagination Parameters

page
integer
default:"1"
Page number to retrieve
per_page
integer
default:"15"
Number of items per page (max: 100)

Rate Limiting

The API implements rate limiting to ensure fair usage and system stability. Rate limits are applied per authenticated user.
Rate limit details are included in response headers when applicable. Contact your administrator for specific rate limit configurations.

Rate Limit Headers

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1640995200
When the rate limit is exceeded, you’ll receive a 429 Too Many Requests response:
{
  "message": "Too Many Attempts.",
  "retry_after": 60
}

API Versioning

The current API version is included in the base URL path: /api
This API does not currently use explicit versioning in the URL. All endpoints are considered stable and backward-compatible changes will be made when possible.
Breaking changes will be communicated in advance and may result in a new API version being released.

Resource Relationships

Many resources include related data through Laravel’s eager loading. Related resources are nested within the response:
{
  "success": true,
  "data": {
    "id_proyecto": 1,
    "nombre": "Torre Central",
    "estado_proyecto": {
      "id_estado": 1,
      "nombre": "Activo"
    },
    "ubicacion": {
      "id_ubicacion": 1,
      "direccion": "Calle 123 #45-67",
      "ciudad": {
        "id_ciudad": 1,
        "nombre": "Bogotá"
      }
    }
  }
}

Date and Time Format

All dates and timestamps use ISO 8601 format:
  • Date: YYYY-MM-DD (e.g., 2024-03-15)
  • DateTime: YYYY-MM-DD HH:mm:ss (e.g., 2024-03-15 14:30:00)
  • Timezone: All times are in UTC unless otherwise specified

Getting Started

  1. Authenticate to obtain an access token
  2. Include the token in the Authorization header of all requests
  3. Explore the available endpoints in the sidebar
  4. Review the response schemas and examples for each endpoint

Authentication

Learn how to authenticate and manage API tokens

Build docs developers (and LLMs) love