This API uses Laravel Sanctum for authentication. To authenticate, you need to include a bearer token in the Authorization header of your requests.
To obtain a token, make a POST request to /api/login
with your email and password. The response will include an access token.
Example:
POST /api/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "password"
}
Response:
{
"access_token": "1|abcdefghijklmnopqrstuvwxyz123456"
}
Include this token in subsequent requests:
Authorization: Bearer 1|abcdefghijklmnopqrstuvwxyz123456
All endpoints are prefixed with /api/v1
.
GET /contacts
POST /contacts
{
"name": "John Doe",
"email": "[email protected]",
"phone": "1234567890"
}
GET /contacts/{id}
PUT /contacts/{id}
{
"name": "John Doe Updated",
"email": "[email protected]",
"phone": "0987654321"
}
DELETE /contacts/{id}
GET /deals
POST /deals
{
"title": "New Deal",
"value": 1000,
"status": "open"
}
GET /deals/{id}
PUT /deals/{id}
{
"title": "Updated Deal",
"value": 2000,
"status": "won"
}
DELETE /deals/{id}
GET /tasks
POST /tasks
{
"title": "New Task",
"description": "Task description",
"due_date": "2023-06-30",
"status": "pending"
}
GET /tasks/{id}
PUT /tasks/{id}
{
"title": "Updated Task",
"description": "Updated description",
"due_date": "2023-07-15",
"status": "in_progress"
}
DELETE /tasks/{id}
The API uses standard HTTP status codes to indicate the success or failure of requests. In case of an error, the response will include a JSON object with an error
key containing a description of the error.
Example error response:
{
"error": "Unauthenticated."
}
Common status codes:
- 200: Success
- 201: Created
- 204: No Content (successful deletion)
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 422: Unprocessable Entity (validation errors)
- 500: Internal Server Error