Skip to content
Navigation

Apply a task template to a trip

POST
https://api.nicer.travel/crm/task-templates/{templateId}/apply

Applies one of the agency's task templates (templateId from GET /crm/settings, taskTemplates) to a trip: each step of the template becomes a task of the trip, dated its offsetDays from the trip's start, end or creation (undated when the trip lacks that date), with origin TEMPLATE, all written at once. Every task is assigned to the caller, to assignedUserId, or with assignedUserId null to the trip's advisor. Publishes crm.task-changed.v1 with action CREATED for each task, and answers them all, in the template's order, with nextToken null. The caller must be the trip's advisor of record or an agency admin. Requires an Idempotency-Key header: a retry with the same key and body answers the same tasks. Errors: 400 ERROR_BODY_VALIDATION, 400 CRM_TASK_TEMPLATE_NOT_FOUND for a template the agency does not have, 404 ERROR_ITEM_NOT_FOUND for a trip the caller may not write about, 409 CRM_IDEMPOTENCY_CONFLICT for a key used with another body, and for a template already applied to the trip.

Authorization

  • bearerAuth
    HTTP Bearer (JWT)
    required

    Authorization: Bearer <token>

Path parameters

  • templateId
    string
    required

Header parameters

  • Idempotency-Key
    string
    required

    Unique key (8–255 chars) per request; replays return the original result.

  • x-nicer-company
    string
    required

    Company context. Authentication and tenant membership are validated by the API.

  • X-Nicer-CRM-Contract
    resource
    required
    example: "resource"

Request body JSON required

  • travelersTripId
    string
    required

    The trip (TT…) the tasks are for. Each task is dated from the trip's start, end or creation, as its step says.

    minLength: 1
  • assignedUserId
    optional

    The user id of the advisor or admin every task goes to. Left out, the caller; null, the trip's advisor, or nobody when the trip has none.

    Any of the following:

    • string
    • null

Returns

200

OK

JSON
  • items
    array of
    object
    required

    The items of this page.

    • assignedUserId
      required

      The advisor or admin who should do it; null when nobody is assigned.

      Any of the following:

      • string
      • null
    • associatedTripItineraryId
      required

      The itinerary (TI…) of the trip the task is about, when it has one; null otherwise.

      Any of the following:

      • string
      • null
    • companyName
      string
      required

      The agency the task belongs to.

    • completed
      boolean
      required

      Whether the task is done.

    • completedAt
      required

      When the task was marked done; null while it is open.

      Any of the following:

      • string
      • null
    • createdAt
      string
      required

      When the task was created.

      format: date-time · pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
    • createdBy
      string
      required

      The user id of who created it, or SYSTEM for the CRM.

    • lastModifiedBy
      string
      required

      The user id of who changed it last, or SYSTEM for the CRM.

    • notes
      required

      More about it; null when there is none.

      Any of the following:

      • string
      • null
    • origin
      ANNIVERSARY
      or
      BIRTHDAY
      or
      DOCUMENT_EXPIRY
      or
      MANUAL
      or
      TEMPLATE
      required

      How the task was made.

    • taskId
      string
      required

      The task's id: what updateTask and deleteTask take.

    • tentativeDate
      required

      When it should be done, as a date; null when undated.

      Any of the following:

      • string
      • null
    • title
      string
      required

      What to do, in a few words.

    • travelerId
      required

      The traveler the task is about; null for a task about a trip. A task is about one traveler or one trip.

      Any of the following:

      • TravelerId
      • null
    • travelerName
      required

      The traveler's name as the agency knows them, read when the task is answered; null for a task about a trip.

      Any of the following:

      • string
      • null
    • travelersTripId
      required

      The trip (TT…) the task is about; null for a task about a traveler.

      Any of the following:

      • string
      • null
    • tripName
      required

      The trip's name, read when the task is answered; null for a task about a traveler or a trip without a name.

      Any of the following:

      • string
      • null
    • updatedAt
      string
      required

      When the task last changed.

      format: date-time · pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
  • nextToken
    required

    Send it back as nextToken to read the next page; null on the last page.

    Any of the following:

    • string
    • null

400

Request failed. errorCode is stable; errorMessage is for humans.
JSON
  • errorCode
    string
    required
  • errorMessage
    string
    required

401

Request failed. errorCode is stable; errorMessage is for humans.
JSON
  • errorCode
    string
    required
  • errorMessage
    string
    required

403

Request failed. errorCode is stable; errorMessage is for humans.
JSON
  • errorCode
    string
    required
  • errorMessage
    string
    required

Type to search…

↑↓ navigate↵ selectEsc close