swagger.yaml

openapi: 3.0.0 info: title: Nectar Public API version: 0.1.0 description: > Welcome to the Nectar Public API. Here you can view and test the provided endpoints before integrating them into your automated systems/tools.

After requesting access to the API through support, you can generate your
API key from the integrations tab in Nectar.

You can access the [Swagger Definition here](/swagger.yaml).

Authentication

All endpoints require an API Key. Be sure to set the Authorization header key to Bearer

contact: name: Nectar Support url: https://nectarhr.com/contact-us servers:

security:

/v1/custom-awards: get: summary: Gets custom awards description: Returns a page (default 25) of custom awards security: - BearerAuth: [] parameters: - name: page in: query description: The page number schema: type: number default: 1 - name: automationEnabled in: query description: Only fetch awards that are enabled for automation schema: type: boolean default: false - name: allTime in: query description: >- Gets all time data with no pagination. Only keys with the INTEGRATION scope can use this. schema: type: boolean default: false responses: '200': description: OK content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' - $ref: '#/components/schemas/CustomAwardsResponse' - $ref: '#/components/schemas/PageInfo' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' /v1/custom-awards/send: post: summary: Sends a custom award to recipients description: | Sends a custom award to one or more recipients within the company. Awards can include optional messages and point values. All recipients must be valid user UUIDs within the organization. security: - BearerAuth: [] requestBody: description: >- The request body requires awardUuid and either recipientUuids or recipientEmails to be provided, but not both. required: true content: application/json: schema: $ref: '#/components/schemas/CustomAwardsBody' responses: '200': description: Custom award sent successfully content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' /v1/flows/trigger/{triggerId}: post: summary: Trigger a Flow for specified users description: | Enrolls users in a Flow via an API trigger. Users can be identified by email or userId. All specified users must be valid members of the company associated with the API key. If any users are not found, the request will fail without enrolling any users. tags: - Flows security: - BearerAuth: [] parameters: - name: triggerId in: path required: true description: The ID of the API trigger to invoke schema: type: string requestBody: description: | Provide either emails or userIds (not both). The trigger must be a PAPI or INTEGRATION trigger type. INTEGRATION triggers require an API key with the INTEGRATION permission. The Flow is resolved automatically from the trigger. required: true content: application/json: schema: $ref: '#/components/schemas/FlowsTriggerBody' responses: '200': description: Users enrolled successfully content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' - $ref: '#/components/schemas/FlowsTriggerResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' /health: get: summary: Health security: [] responses: '200': description: OK /v1/recognition/feed: get: summary: Gets the companies recognition feed security: - BearerAuth: [] responses: '200': description: OK content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' - $ref: '#/components/schemas/ShoutoutsResponse' text/csv: schema: type: string '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' parameters: - name: type in: query schema: type: array items: type: string enum: - nomination_post - nomination_response - birthday - anniversary - award - challenge - welcome - setup - shoutout explode: false style: form description: Type of post - name: private in: query schema: type: boolean - name: hidden_from_leaderboard in: query schema: type: boolean - name: deleted in: query schema: type: boolean default: false - name: minify in: query schema: type: boolean default: false description: Get only minified user data. Only for 'text/csv' format - name: expand in: query schema: type: array items: type: string enum: - user explode: false style: form description: Return each users' expanded data - name: cursor in: query schema: type: number description: Unix timestamp for next date range of feed entries - name: start-date in: query schema: type: string format: date description: >- Start Date of range to get data from as defined by RFC 3339, section 5.6, for example, 2017-07-21. - name: end-date in: query schema: type: string format: date description: >- End Date of range to get data from as defined by RFC 3339, section 5.6, for example, 2017-07-21. If defined, start-date is required. - name: all_time in: query schema: type: boolean description: >- Gets all time data with no pagination. Only keys with the AI_INSIGHT scope can use this. /v1/users/{userId}: get: summary: Gets general information about a specific user security: - BearerAuth: [] responses: '200': description: OK content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' - $ref: '#/components/schemas/UserDetailsResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' parameters: - name: expand in: query schema: type: array items: type: string enum: - user explode: false style: form description: Return each users' expanded data - name: userId in: path required: true schema: type: string description: The id of the user to fetch data for /v1/users: get: summary: Gets a paginated list of users within the company security: - BearerAuth: [] responses: '200': description: OK content: application/json: schema: allOf: - $ref: '#/components/schemas/SuccessfulResponse' - $ref: '#/components/schemas/UsersResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError' '501': $ref: '#/components/responses/NotImplemented' parameters: - name: expand in: query schema: type: array items: type: string enum: - user explode: false style: form description: Return each users' expanded data - name: active in: query schema: type: boolean - name: invited in: query schema: type: boolean - name: email in: query schema: type: string - name: employee_id in: query schema: type: string - name: cursor in: query schema: type: string - name: limit in: query schema: type: number put: summary: >- Upsert up to 50 users at a time based on nectar_id (recommended), email, or employee_id description: > Creates or updates users. Supports inviting users via the user_invited field and send_invites query parameter.

    **Invite behavior:**
    
    - Setting `user_invited: true` on a user in the request body will mark
      that user as invited in the database.
    
    - Invite emails are **only sent** when `send_invites=true` is passed as
      a query parameter.
    
    - When `send_invites=true`, invite emails are sent to all users that
      have `user_invited: true` **in the current request body**,
      including users that were already invited previously.
    
    - When `send_invites=false` or omitted, `user_invited: true` still
      updates the database, but no emails are sent.
    
    - `user_invited` can only be set to `true`. Setting it to `false` is not
      allowed and will return an error.
    
    - The response includes an `invite_email_sent` field for each user
      indicating whether an invite email was sent during this request.
    
    **Duplicate identifiers:**
    
    - When multiple users in the request share the same `email`,
      `employee_id`, or `phone_number`, the request still returns 200
      but the response `warnings` array describes which duplicates were
      detected and how they were handled.
    
    - Duplicate `email` or `employee_id`: all users sharing that value are
      skipped (not created or updated).
    
    - Duplicate `phone_number`: if the user has another identifier (email,
      employee_id, nectar_id), the phone number is stripped
      and the user is still processed; otherwise the user is skipped.
    
    - Callers should inspect `warnings` after every upsert to reconcile
      their source data.
  security:
    - BearerAuth: []
  responses:
    '200':
      description: OK
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/SuccessfulResponse'
              - $ref: '#/components/schemas/UsersResponse'
    '400':
      $ref: '#/components/responses/BadRequest'
    '401':
      $ref: '#/components/responses/Unauthorized'
    '403':
      $ref: '#/components/responses/Forbidden'
    '404':
      $ref: '#/components/responses/NotFound'
    '429':
      $ref: '#/components/responses/TooManyRequests'
    '500':
      $ref: '#/components/responses/InternalServerError'
    '501':
      $ref: '#/components/responses/NotImplemented'
  parameters:
    - name: expand
      in: query
      schema:
        type: array
        items:
          type: string
          enum:
            - user
      explode: false
      style: form
      description: Returns the created/updated users base or expanded data
    - name: lookup_keys
      in: query
      schema:
        type: array
        items:
          type: string
          enum:
            - nectar_id
            - email
            - employee_id
      explode: false
      style: form
      description: >-
        The keys to use to lookup users. If none are provided, defaults to
        the behavior below.
    - name: send_invites
      in: query
      schema:
        type: boolean
        description: >-
          When set to `true`, invite emails will be sent to all users with
          `user_invited: true` in the request body, including users that were
          already invited previously. When set to `false` or omitted,
          `user_invited: true` will still update the user in the database but
          no invite emails will be sent.
  requestBody:
    description: >-
      Specifying `nectar_id` allows a request to update both `employee_id`
      and `email` in the same request. If `nectar_id` is not provided,
      matches on `employee_id`, then `email`, if neither are found, creates
      a new user.

Passing null for a custom property will remove the user from that property. required: true content: application/json: schema: $ref: '#/components/schemas/UserUpsertRequestBody' tags: []