Proposals (AI Agent)

The AI agent can propose itinerary changes that users can accept or reject before they're applied.

List Proposals

Get all proposals for a trip.

Endpoint: GET /api/v1/trips/{tripId}/proposals

Response:

[
  {
    "proposalId": "abc123",
    "tripId": 1,
    "status": "pending",
    "entities": [...],
    "createdAt": "2024-01-15T10:00:00Z",
    "expiresAt": "2024-01-15T11:00:00Z"
  }
]

Create Proposal

Create a new proposal (typically done by AI agent).

Endpoint: POST /api/v1/trips/{tripId}/proposals

Request Body

{
  "entities": [
    {
      "type": "flight",
      "title": "Paris to Rome",
      "startDateTime": "2024-06-20T08:00:00Z",
      "endDateTime": "2024-06-20T10:00:00Z"
    }
  ],
  "options": {
    "autoAccept": false
  }
}

Get Proposal

Endpoint: GET /api/v1/trips/{tripId}/proposals/{proposalId}


Accept Proposal

Accept a proposal and apply its changes to the trip.

Endpoint: POST /api/v1/trips/{tripId}/proposals/{proposalId}?action=accept

curl -X POST "https://travelmode2.replit.app/api/v1/trips/1/proposals/abc123?action=accept" \
  -H "Authorization: Bearer tm_your_api_key"

Response:

{
  "success": true,
  "eventsCreated": 2,
  "newRevision": 44
}

Reject Proposal

Reject a proposal without applying changes.

Endpoint: POST /api/v1/trips/{tripId}/proposals/{proposalId}?action=reject

Response:

{
  "success": true,
  "status": "rejected"
}

Proposal Status

StatusDescription
pendingAwaiting user decision
acceptedUser accepted, changes applied
rejectedUser rejected
expiredProposal expired without action