Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Sufianeh7/AmigoInvisible/llms.txt

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

This endpoint retrieves the complete sorteo document for a group identified by its adminToken. The full Mongoose document is returned as-is, including all participant data, the current draw status, and any historical pairing records.

Request

Method: GET
URL: /api/sorteos/:adminToken
Body: None required.

Path Parameters

adminToken
string
required
The UUID returned when the group was created via POST /api/sorteos. This value uniquely identifies the group in MongoDB and authorises access to its data.

Example Request

curl https://amigo-invisible-node-87yz.vercel.app/api/sorteos/550e8400-e29b-41d4-a716-446655440000

Response

Status: 200 OK The full Mongoose document is returned. Field descriptions follow the MongoDB schema defined in Sorteo.js.
_id
string
MongoDB-generated document identifier (ObjectId serialised as a hex string).
nombreGrupo
string
Display name of the group, as provided at creation time.
presupuesto
string
Free-text budget description (e.g. "20€ - 30€"). May be absent if not provided at creation.
fechaEntrega
string
Planned gift exchange date in ISO 8601 format. May be absent if not provided at creation.
adminToken
string
The group’s admin token — mirrors the value used in the request path.
estado
string
Current lifecycle status of the group. One of:
  • "borrador" — the group has been created but the draw has not yet been launched.
  • "completado" — the draw has been run and reveal emails have been sent.
participantes
array
Array of participant objects registered in the group.
nombre
string
Participant’s display name.
email
string
Participant’s email address.
exclusiones
array of strings
Names of participants this person must never be assigned to gift.
emparejamientosPasados
array
Historical record of past draws for this group. Each entry contains:
  • fechaSorteo — timestamp of when the draw took place.
  • parejas — array of { de, para } pairing objects (both values are email addresses).
This array is empty ([]) until a draw has been launched and completed.
createdAt
string
ISO 8601 timestamp of when the document was first saved. Added automatically by Mongoose’s timestamps option.
updatedAt
string
ISO 8601 timestamp of the most recent document update. Added automatically by Mongoose’s timestamps option.

Example Response

{
  "_id": "64b2f...",
  "nombreGrupo": "Navidad Familia Pérez",
  "presupuesto": "20€ - 30€",
  "adminToken": "550e8400-e29b-41d4-a716-446655440000",
  "estado": "borrador",
  "participantes": [
    { "nombre": "Ana",   "email": "ana@example.com",   "exclusiones": [] },
    { "nombre": "Luis",  "email": "luis@example.com",  "exclusiones": ["Ana"] },
    { "nombre": "Marta", "email": "marta@example.com", "exclusiones": [] }
  ],
  "emparejamientosPasados": [],
  "createdAt": "2024-12-01T10:00:00.000Z",
  "updatedAt": "2024-12-01T10:00:00.000Z"
}

Error Responses

StatusScenarioBody
404No group found for the supplied adminToken, or the token is malformed{ "error": "Sorteo no encontrado o el enlace es inválido." }
500Unexpected database or server error{ "error": "Error interno del servidor" }

Build docs developers (and LLMs) love