NationBuilder Path Histories API

Documents a signup's step along a path journey.

OpenAPI Specification

nationbuilder-path-histories-api-openapi.yml Raw ↑
openapi: 3.1.2
info:
  title: NationBuilder V2 Async Processes Path Histories API
  version: '2.0'
  description: 'The NationBuilder V2 API is a JSON:API-compliant API for managing NationBuilder

    resources such as people, donations, events, and lists. It layers a few

    conventions on top of the JSON:API standard, described below. For a broader

    introduction, see the

    [NationBuilder v2 API core concepts](https://support.nationbuilder.com/en/articles/9757369-nationbuilder-v2-api-core-concepts)

    guide.


    ### Request and response format


    Requests and responses follow the [JSON:API](https://jsonapi.org/) document

    structure: single resources are returned under a top-level `data` member, and

    collections are paginated arrays of resource objects with `links` for the

    current, previous, and next pages. Related resources can be sideloaded into a

    top-level `included` array with the `include` query parameter, and responses

    can be trimmed to specific attributes with `fields[resource_type]` sparse

    fieldsets (plus opt-in `extra_fields[resource_type]` attributes where noted).

    Responses are served as `application/vnd.api+json`; request bodies may be

    sent as `application/vnd.api+json` or `application/json`.


    Filtering uses an operator syntax: `filter[attribute]=value` for

    equality (comma-separated values act as OR), and

    `filter[attribute][operator]=value` for other comparisons. String attributes

    support `eq`, `not_eq`, `eql`, `not_eql`, `prefix`, `not_prefix`, `suffix`,

    `not_suffix`, `match`, and `not_match`; numeric and date attributes support

    `eq`, `not_eq`, `gt`, `gte`, `lt`, and `lte`. Note that JSON:API relationship

    routes (`/resource/{id}/relationships/other`) are not provided; related

    resources are reachable through the filtered index URLs given in each

    resource''s `relationships` links.


    ### Errors


    Error responses use a flat JSON body with a machine-readable `code` and a

    human-readable `message`. Some errors carry additional detail members (for

    example `validation_errors`). The exception is 422 validation failures,

    which return a JSON:API `errors` array locating each invalid field via

    `source.pointer`.


    ### Rate limiting


    Requests are limited per access token (250 requests per 10-second window).

    Every response includes `RateLimit-Limit`, `RateLimit-Remaining`, and

    `RateLimit-Reset` headers; exceeding the limit returns a 429 with a

    `Retry-After` header.

    '
servers:
- url: https://{subdomain}.nationbuilder.com
  variables:
    subdomain:
      default: yournation
      description: Your NationBuilder nation slug
security:
- BearerAuth: []
tags:
- name: Path Histories
  x-tag-expanded: false
  description: Documents a signup's step along a path journey.
paths:
  /api/v2/path_histories:
    parameters:
    - $ref: '#/components/parameters/path_history_index_include'
    - $ref: '#/components/parameters/path_history_sparse_fields'
    get:
      summary: List all path histories in a nation
      tags:
      - Path Histories
      description: Lists all path histories
      operationId: listPathHistories
      parameters:
      - $ref: '#/components/parameters/pagination_number'
      - $ref: '#/components/parameters/pagination_size'
      responses:
        '200':
          description: A page of matching path histories.
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/path_history_index_response'
        '401':
          $ref: '#/components/responses/unauthorized'
        '429':
          $ref: '#/components/responses/rate_limited'
  /api/v2/path_histories/{id}:
    parameters:
    - $ref: '#/components/parameters/id'
    - $ref: '#/components/parameters/path_history_show_include'
    - $ref: '#/components/parameters/path_history_sparse_fields'
    get:
      summary: Show path history with provided ID
      tags:
      - Path Histories
      description: Returns the JSON:API resource object for a single path history.
      operationId: showPathHistory
      responses:
        '200':
          description: The requested path history.
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/path_history_show_response'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found'
        '429':
          $ref: '#/components/responses/rate_limited'
components:
  schemas:
    error_response:
      description: The error body returned for 4xx and 5xx responses, with a machine-readable code and a human-readable message. Some errors include additional detail members alongside these two. The exception is 422 validation failures, which are returned as JSON:API errors documents instead.
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: string
          description: Machine-readable error code identifying the failure.
          examples:
          - not_found
        message:
          type: string
          description: Human-readable explanation of the failure.
          examples:
          - Record not found
    path_history_response_data:
      description: The JSON:API resource object representing a path history.
      allOf:
      - $ref: '#/components/schemas/resource_identifier'
      - type: object
        properties:
          type:
            const: path_histories
            examples:
            - path_histories
          attributes:
            $ref: '#/components/schemas/path_history_read_only_attributes'
    show_document:
      description: The JSON:API top-level document shape for responses returning a single resource under the data member.
      type: object
      required:
      - data
      properties:
        data:
          type: object
          description: The primary resource object; each resource binds its concrete schema here via allOf composition.
        included:
          $ref: '#/components/schemas/included'
        meta:
          type: object
          description: Non-standard information about the document. Empty unless the endpoint has metadata to convey.
    path_history_field_values:
      description: Readable path_history attribute names selectable with sparse fieldsets (fields[path_histories]).
      type: string
      enum:
      - category
      - created_at
      - current_step_point_person_id
      - path_journey_id
      - path_journey_status_change_id
      - path_step_id
      - point_person_id
      - recruiter_id
      - updated_at
    resource_identifier:
      description: A JSON:API resource identifier object, the type/id pair that uniquely identifies a single resource.
      type: object
      required:
      - type
      - id
      properties:
        id:
          type: string
          description: Unique identifier of the resource.
          examples:
          - '1'
        type:
          type: string
          description: The JSON:API resource type.
    path_history_index_response:
      description: A paginated JSON:API response containing a list of path histories.
      allOf:
      - $ref: '#/components/schemas/index_document'
      - type: object
        properties:
          data:
            type: array
            items:
              $ref: '#/components/schemas/path_history_response_data'
    pagination_links:
      description: JSON:API pagination links for the pages of a collection. A key whose page is unavailable, or that the server's pagination strategy does not provide, is omitted or null.
      type: object
      properties:
        self:
          type: string
          description: Link to the current page.
          examples:
          - /articles?page[number]=2
        first:
          type:
          - string
          - 'null'
          description: Link to the first page.
          examples:
          - /articles?page[number]=1
        last:
          type:
          - string
          - 'null'
          description: Link to the last page.
          examples:
          - /articles?page[number]=5
        prev:
          type:
          - string
          - 'null'
          description: Link to the previous page.
          examples:
          - /articles?page[number]=1
        next:
          type:
          - string
          - 'null'
          description: Link to the next page.
          examples:
          - /articles?page[number]=3
    path_history_read_only_attributes:
      description: The read-only attributes of a path_history.
      type: object
      properties:
        category:
          type:
          - string
          - 'null'
          enum:
          - step_change
          - completion
          - abandonment
          - new_point_person
          - new_current_step_point_person
          - voiding
          - reactivation
          - null
          examples:
          - step_change
          description: Categorizes the path history.
        created_at:
          type: string
          format: date-time
          examples:
          - '2019-10-26T10:00:00-04:00'
        current_step_point_person_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The point person for the current step.
        path_journey_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The associated path journey.
        path_journey_status_change_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The associated path journey status change.
        path_step_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The associated path step.
        point_person_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The point person.
        recruiter_id:
          type:
          - string
          - 'null'
          examples:
          - '1'
          description: The recruiter.
        updated_at:
          type: string
          format: date-time
          examples:
          - '2019-10-26T10:00:00-04:00'
    path_history_sideload_values:
      description: Relationship names that can be sideloaded with the include query parameter on path_history endpoints.
      type: string
      enum:
      - current_step_point_person
      - path_journey
      - path_journey_status_change
      - point_person
      - recruiter
    index_document:
      description: The JSON:API top-level document shape for paginated collection responses, with resource objects under data and pagination links.
      type: object
      required:
      - data
      properties:
        data:
          type: array
          description: The page of resource objects for this collection; each resource binds its concrete item schema here via allOf composition.
        links:
          $ref: '#/components/schemas/pagination_links'
        included:
          $ref: '#/components/schemas/included'
        meta:
          type: object
          description: Non-standard information about the document, such as requested statistics. Empty unless the endpoint has metadata to convey.
    path_history_show_response:
      description: A JSON:API response containing a single path history.
      allOf:
      - $ref: '#/components/schemas/show_document'
      - type: object
        properties:
          data:
            $ref: '#/components/schemas/path_history_response_data'
    rate_limited_response:
      description: The body returned by the rate limiter when an access token exceeds its request quota.
      type: object
      required:
      - message
      properties:
        message:
          type: string
          description: Human-readable explanation of the rate limit.
          examples:
          - You have made too many requests. Please try again later.
    resource:
      description: A generic JSON:API resource object. Resources sideloaded in a document's included member use this shape; their attributes are those of the resource type named in the type member.
      allOf:
      - $ref: '#/components/schemas/resource_identifier'
      - type: object
        properties:
          attributes:
            type: object
            description: The attributes of the resource, as documented for its resource type.
          relationships:
            type: object
            description: References from this resource to other resources in the document.
    included:
      description: Sideloaded resources requested via the include query parameter. Each entry is a full resource object whose shape is documented under its own resource type.
      type: array
      items:
        $ref: '#/components/schemas/resource'
  parameters:
    pagination_size:
      name: page[size]
      description: 'Number of results to display per page (default: 20, max: 100, min: 1)'
      in: query
      required: false
      schema:
        type: string
        default: '20'
    path_history_sparse_fields:
      name: fields[path_histories]
      in: query
      required: false
      description: Comma-delimited list of path history attributes to only return in the response
      schema:
        type: array
        default: []
        uniqueItems: true
        items:
          $ref: '#/components/schemas/path_history_field_values'
      style: form
      explode: false
    id:
      name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    path_history_show_include:
      name: include
      in: query
      description: 'Comma-delimited list of sideloaded resources to include as part of the path history response.

        See guidance [here](https://support.nationbuilder.com/en/articles/9899245-api-v2-walkthrough#h_2d5333adab) about

        sideloading large numbers of resources and pagination.

        '
      schema:
        type: array
        default: []
        uniqueItems: true
        items:
          $ref: '#/components/schemas/path_history_sideload_values'
      required: false
      style: form
      explode: false
    path_history_index_include:
      name: include
      in: query
      description: 'Comma-delimited list of sideloaded resources to include as part of the path history index response.

        See guidance [here](https://support.nationbuilder.com/en/articles/9899245-api-v2-walkthrough#h_2d5333adab) about

        sideloading large numbers of resources and pagination.

        '
      schema:
        type: array
        default: []
        uniqueItems: true
        items:
          $ref: '#/components/schemas/path_history_sideload_values'
      required: false
      style: form
      explode: false
    pagination_number:
      name: page[number]
      description: Page number to list (starting at 1)
      in: query
      required: false
      schema:
        type: string
        default: '1'
  headers:
    RateLimit-Remaining:
      description: Number of requests remaining for the current access token in the current rate-limit window.
      schema:
        type: string
        examples:
        - '249'
      examples: {}
    Retry-After:
      description: Number of seconds to wait before retrying. Sent with 429 responses.
      schema:
        type: string
        examples:
        - '10'
      examples: {}
    RateLimit-Limit:
      description: Maximum number of requests allowed for the current access token per rate-limit window (10 seconds).
      schema:
        type: string
        examples:
        - '250'
      examples: {}
    RateLimit-Reset:
      description: Unix timestamp (in seconds) at which the current rate-limit window resets.
      schema:
        type: string
        examples:
        - '1719964810'
      examples: {}
  responses:
    unauthorized:
      description: The access token is missing, expired, or not authorized to access this resource.
      headers:
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          example:
            code: unauthorized
            message: You are not authorized to access this content. Your access token may be missing. The resource owner also may not have a permission level sufficient to grant access.
          schema:
            $ref: '#/components/schemas/error_response'
    rate_limited:
      description: The access token has exceeded its request quota for the current rate-limit window.
      headers:
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          example:
            message: You have made too many requests. Please try again later.
          schema:
            $ref: '#/components/schemas/rate_limited_response'
    not_found:
      description: No resource exists with the provided ID.
      headers:
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          example:
            code: not_found
            message: Record not found
          schema:
            $ref: '#/components/schemas/error_response'
  securitySchemes:
    BearerAuth:
      description: Authentication using a bearer token (JWT) issued via OAuth.
      type: http
      scheme: bearer
      bearerFormat: JWT
externalDocs:
  description: Get started with the NationBuilder API
  url: https://nationbuilder.com/api_quickstart