Skip to main content
Events are the central resource in Eventify. Each event record holds scheduling information (start and end dates), logistics details (capacity, attendee count, price, and location), and classification metadata (category and status). The five endpoints below give you complete control over event data: listing all events with their related records eager-loaded, fetching a single event by ID, creating a new event, updating an existing one, or deleting it permanently.

The event object

Every successful response involving a single event — or each element in an array response — returns an event object with the following fields.
integer
Auto-incremented primary key uniquely identifying the event.
integer | null
Foreign key referencing the users table. Identifies the user who owns or created the event. null if no user is assigned (set to null on user deletion).
integer | null
Foreign key referencing the statuses table. Defaults to 1 (Disponible) on creation. Set to null on status deletion.
integer | null
Foreign key referencing the locations table. Set to null on location deletion.
integer | null
Foreign key referencing the categories table. Set to null on category deletion.
string
Display name of the event. Maximum 255 characters.
string
Full text description of the event.
string
URL pointing to the event’s cover image. Stored as a non-nullable string in the database; pass an empty string if no image URL is available.
integer
Total number of attendee spots available for the event.
integer
Current number of confirmed attendees. Defaults to 0 at creation and is incremented by the system as tickets are issued.
integer
Ticket price for the event (stored as an integer, representing the smallest currency unit or whole currency amount depending on your locale).
datetime
ISO 8601 datetime string indicating when the event begins.
datetime
ISO 8601 datetime string indicating when the event ends. Always on or after start_date.
datetime
ISO 8601 datetime string set automatically when the record is first created.
datetime
ISO 8601 datetime string updated automatically whenever the record is modified.
object
Eager-loaded category object (id, name, created_at, updated_at). Present on index and show responses.
object
Eager-loaded location object (id, address, city, region, country, latitude, longitude, created_at, updated_at). Present on index and show responses.
object
Eager-loaded user object. Present on index and show responses.
object
Eager-loaded status object (id, name, created_at, updated_at). Present on index and show responses.

GET /api/event

Returns an array of all events in the database. Each event object includes the fully eager-loaded category, location, user, and status relations so that you do not need to make additional requests to resolve associated records.
Response — 200 OK
Returns an empty array [] with status 200 when no events exist.

GET /api/event/{id}

Returns a single event identified by its integer id, with all relations eager-loaded. Path parameter
integer
required
The unique identifier of the event to retrieve.
Response — 200 OK
Error responses

POST /api/event

Creates a new event record. The request body must be JSON or form-encoded and pass all required field validations. On success the newly created event is returned with HTTP 201 Created. The attendees field is not accepted as input — it starts at 0 and is managed by the system. Request body
string
required
Display name of the event. Maximum 255 characters.
string
required
Full text description of the event.
integer
required
Total number of available attendee spots.
integer
required
Ticket price for the event.
date
required
Event start date/time. Must be a valid date string parseable by PHP (e.g. 2024-09-15 or 2024-09-15T09:00:00).
date
required
Event end date/time. Must be a valid date on or after start_date.
integer
required
ID of an existing category from the categories table.
integer
required
ID of an existing location from the locations table.
integer
required
ID of an existing status from the statuses table.
integer
Optional. ID of an existing user to associate with the event. May be omitted or explicitly sent as null.
string
Optional. URL string for the event’s cover image. May be omitted or explicitly sent as null.
Response — 201 Created
The store response returns the raw event model without eager-loaded relations. Call GET /api/event/{id} if you need the full relational payload immediately after creation.
Error responses

PUT /api/event/{id}

Updates an existing event. All body fields are optional — only the fields you include will be changed. Any field you do provide is still subject to the same validation rules as on creation. Path parameter
integer
required
The unique identifier of the event to update.
Request body — all fields optional
string
New display name. Maximum 255 characters.
string
New description text.
integer
Updated total capacity.
integer
Updated ticket price.
date
Updated start date/time.
date
Updated end date/time. Must be on or after start_date when provided.
integer
ID of the new category. Must exist in the categories table.
integer
ID of the new location. Must exist in the locations table.
integer
ID of the new status. Must exist in the statuses table.
integer
ID of the new owning user. May be null.
string
New cover image URL. May be null.
Response — 200 OK
Error responses

DELETE /api/event/{id}

Permanently deletes the event with the given ID. The underlying database record uses soft-deletes (the deleted_at column from the migration), so deleted rows are retained at the database level but excluded from all queries. Path parameter
integer
required
The unique identifier of the event to delete.
Response — 200 OK
Error responses
Deletion is irreversible from the API’s perspective. Although soft-delete means the database row is preserved, there is no un-delete endpoint exposed by the API.