Skip to content
Navigation

Update the CRM settings

PUT
https://api.nicer.travel/crm/settings

Replaces the sections of the settings the body names (customFields, defaultVisibility, segments, taskTemplates, webhooks) if the settings are still at the revision sent, and answers the settings as GET /crm/settings does, at the next revision. Each list sent replaces the stored one whole: an item sent with its id keeps it, one without is new and gets an id, and a stored item left out is deleted; a section left out stays as it is. A webhook sent without the webhookId of a stored one is new: its signing secret is in this answer, as that webhook's secret, and in no answer again, so store it now. Every delivery to the webhook is signed with it (X-Nicer-Signature). The change publishes crm.settings-updated.v1 with the sections it replaced. Admins only. Errors: 400 ERROR_BODY_VALIDATION, also for a body with the revision alone or two custom fields with one key; 403 ERROR_UNAUTHORIZED for anyone but an admin; 409 CRM_REVISION_CONFLICT when the settings changed since they were read: read them again.

Authorization

  • bearerAuth
    HTTP Bearer (JWT)
    required

    Authorization: Bearer <token>

Header parameters

  • 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

  • revision
    integer
    required

    The revision of the settings as read; a change made since answers 409 CRM_REVISION_CONFLICT.

    maximum: 9007199254740991 · minimum: 0
  • customFields
    optional
    array of
    object

    Every custom field to keep, up to 50, each key once; a stored field left out is deleted.

    • key
      string
      required

      The key a traveler's value is stored under in their customFields, in camelCase: a lowercase letter, then up to 39 letters or digits, e.g. favoriteAirline. Unique among the agency's fields.

      pattern: ^[a-z][a-zA-Z0-9]{0,39}$
    • label
      string
      required

      The name the agency's screens show for the field, 1 to 60 characters.

      maxLength: 60 · minLength: 1
    • options
      array of
      string
      required

      The choices of a SELECT field, up to 30, each 1 to 60 characters; a traveler's value must be one of them. The other types ignore it: send an empty list.

      maxLength: 60 · minLength: 1
    • type
      BOOLEAN
      or
      DATE
      or
      NUMBER
      or
      SELECT
      or
      TEXT
      required

      The kind of value the field holds; a traveler's value that is not of this kind is refused.

  • defaultVisibility
    optional
    ADVISORS
    or
    COMPANY

    Who sees a new traveler unless it says otherwise.

  • segments
    optional
    array of
    object

    Every segment to keep, up to 50; a stored segment left out is deleted.

    • filter
      object
      required

      The conditions the segment's travelers meet.

      • assignedAdvisorUserId
        optional
        string

        Travelers this advisor serves, by user id. Left out, any advisor.

        minLength: 1
      • documentExpiringWithinDays
        optional
        integer

        Travelers with a document that expires within this many days, 1 to 730.

        maximum: 730 · minimum: 1
      • isArchived
        optional
        boolean

        True keeps archived travelers, false the ones not archived. Left out, the list's own isArchived decides: travelers not archived, unless it says otherwise.

      • nextTripWithinDays
        optional
        integer

        Travelers whose next trip starts within this many days, 1 to 365.

        maximum: 365 · minimum: 1
      • stage
        optional
        CLIENT
        or
        LEAD

        Travelers at this stage only.

      • tag
        optional
        string

        Travelers with this tag only.

        maxLength: 40 · minLength: 1
    • name
      string
      required

      The segment's name, 1 to 80 characters.

      maxLength: 80 · minLength: 1
    • segmentId
      optional
      string

      The id of the stored segment this one replaces; left out for a new segment, which gets an id.

      minLength: 1
  • taskTemplates
    optional
    array of
    object

    Every task template to keep, up to 30; a stored template left out is deleted.

    • applyOnTripCreated
      boolean
      required

      Whether the template is applied to every trip of the agency as soon as the trip is created.

    • name
      string
      required

      The template's name, 1 to 80 characters.

      maxLength: 80 · minLength: 1
    • tasks
      array of
      object
      required

      The tasks the template adds to a trip, 1 to 30.

      • anchor
        TRIP_CREATED
        or
        TRIP_END
        or
        TRIP_START
        required

        The trip date the task's date counts from.

      • offsetDays
        integer
        required

        Days after the anchor, -365 to 365; negative is before it, 0 is the anchor's day.

        maximum: 365 · minimum: -365
      • title
        string
        required

        The title of the task the template adds, 1 to 255 characters.

        maxLength: 255 · minLength: 1
    • templateId
      optional
      string

      The id of the stored template this one replaces; left out for a new template, which gets an id.

      minLength: 1
  • webhooks
    optional
    array of
    object

    Every webhook to keep, up to 10; a stored webhook left out is deleted and its secret with it.

    • events
      array of
      string
      ·
      one of 14 values
      required

      The events to send to it, at least one.

      Allowed values: crm.advisor-reminders-due.v1, crm.note-changed.v1, crm.settings-updated.v1, crm.task-changed.v1, crm.traveler-advisors-changed.v1, crm.traveler-created.v1, crm.traveler-documents-changed.v1, crm.traveler-erased.v1, crm.traveler-invitation-requested.v1, crm.traveler-linked.v1, crm.traveler-unlinked.v1, crm.traveler-updated.v1, crm.travelers-merged.v1, crm.trip-updated.v1
    • isActive
      boolean
      required

      Whether events are sent to it; false pauses it.

    • url
      string
      required

      The HTTPS address the events are posted to, at most 2,048 characters.

      format: uri · maxLength: 2048
    • webhookId
      optional
      string

      The id of the stored webhook this one replaces, which keeps its secret and creation time. Left out, or one the agency does not have, the webhook is new: it gets an id and a signing secret, answered once.

      minLength: 1

Returns

200

OK

JSON
  • companyName
    string
    required

    The agency the settings belong to.

  • customFields
    array of
    object
    required

    The fields the agency adds to its travelers.

    • key
      string
      required

      The key a traveler's value is stored under in their customFields, in camelCase: a lowercase letter, then up to 39 letters or digits, e.g. favoriteAirline. Unique among the agency's fields.

      pattern: ^[a-z][a-zA-Z0-9]{0,39}$
    • label
      string
      required

      The name the agency's screens show for the field, 1 to 60 characters.

      maxLength: 60 · minLength: 1
    • options
      array of
      string
      required

      The choices of a SELECT field, up to 30, each 1 to 60 characters; a traveler's value must be one of them. The other types ignore it: send an empty list.

      maxLength: 60 · minLength: 1
    • type
      BOOLEAN
      or
      DATE
      or
      NUMBER
      or
      SELECT
      or
      TEXT
      required

      The kind of value the field holds; a traveler's value that is not of this kind is refused.

  • defaultVisibility
    ADVISORS
    or
    COMPANY
    required

    Who sees a new traveler unless it says otherwise.

  • revision
    integer
    required

    The settings' revision, to send back with a change; 0 until the settings are saved for the first time.

    maximum: 9007199254740991 · minimum: 0
  • segments
    array of
    object
    required

    The agency's saved filters of travelers.

    • filter
      object
      required

      The conditions the segment's travelers meet.

      • assignedAdvisorUserId
        optional
        string

        Travelers this advisor serves, by user id. Left out, any advisor.

        minLength: 1
      • documentExpiringWithinDays
        optional
        integer

        Travelers with a document that expires within this many days, 1 to 730.

        maximum: 730 · minimum: 1
      • isArchived
        optional
        boolean

        True keeps archived travelers, false the ones not archived. Left out, the list's own isArchived decides: travelers not archived, unless it says otherwise.

      • nextTripWithinDays
        optional
        integer

        Travelers whose next trip starts within this many days, 1 to 365.

        maximum: 365 · minimum: 1
      • stage
        optional
        CLIENT
        or
        LEAD

        Travelers at this stage only.

      • tag
        optional
        string

        Travelers with this tag only.

        maxLength: 40 · minLength: 1
    • name
      string
      required

      The segment's name, 1 to 80 characters.

      maxLength: 80 · minLength: 1
    • segmentId
      string
      required

      The segment's id: what GET /crm/travelers?segmentId= takes.

      minLength: 1
  • taskTemplates
    array of
    object
    required

    The agency's task templates.

    • applyOnTripCreated
      boolean
      required

      Whether the template is applied to every trip of the agency as soon as the trip is created.

    • name
      string
      required

      The template's name, 1 to 80 characters.

      maxLength: 80 · minLength: 1
    • tasks
      array of
      object
      required

      The tasks the template adds to a trip, 1 to 30.

      • anchor
        TRIP_CREATED
        or
        TRIP_END
        or
        TRIP_START
        required

        The trip date the task's date counts from.

      • offsetDays
        integer
        required

        Days after the anchor, -365 to 365; negative is before it, 0 is the anchor's day.

        maximum: 365 · minimum: -365
      • title
        string
        required

        The title of the task the template adds, 1 to 255 characters.

        maxLength: 255 · minLength: 1
    • templateId
      string
      required

      The template's id: what POST /crm/task-templates/{templateId}/apply takes.

      minLength: 1
  • updatedAt
    required

    When the settings last changed; null until the first save.

    Any of the following:

    • string
    • null
  • webhooks
    array of
    object
    required

    The agency's webhooks. Only the answer to an update carries a secret, and only on the webhooks that update created.

    • createdAt
      string
      required

      When the webhook was added.

      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))$
    • events
      array of
      string
      ·
      one of 14 values
      required

      The events sent to the webhook.

      Allowed values: crm.advisor-reminders-due.v1, crm.note-changed.v1, crm.settings-updated.v1, crm.task-changed.v1, crm.traveler-advisors-changed.v1, crm.traveler-created.v1, crm.traveler-documents-changed.v1, crm.traveler-erased.v1, crm.traveler-invitation-requested.v1, crm.traveler-linked.v1, crm.traveler-unlinked.v1, crm.traveler-updated.v1, crm.travelers-merged.v1, crm.trip-updated.v1
    • isActive
      boolean
      required

      Whether events are sent to it; false pauses it without losing it.

    • secretLast4
      string
      required

      The last four characters of the signing secret, to tell secrets apart.

    • url
      string
      required

      The HTTPS address the events are posted to.

      format: uri · maxLength: 2048
    • webhookId
      string
      required

      The webhook's id, sent back in an update to keep the webhook and its secret.

      minLength: 1
    • secret
      optional
      string

      The signing secret (whsec_…) the endpoint checks each delivery's X-Nicer-Signature with. Present only in the answer to the update that created the webhook, and never again: store it then.

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