> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cimento.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List training campaigns

> The tenant's training campaigns, latest start first, each with its name, course, status, dates and how many people it assigns. `query` searches campaign and course names; `status`, `courseId`, `startsFrom` and `startsBefore` narrow the list. Use a campaign's `trainingCampaignId` to read what it is set to. Pages with `limit` and `offset`: the answer has `totalCount` for the whole list and, while more remain, `nextOffset` to pass back as `offset`.



## OpenAPI

````yaml https://api.cimento.app/v1/openapi.json get /v1/training/campaigns
openapi: 3.1.0
info:
  description: >-
    Read-only access to a Cimento tenant's phishing, training and AutoPhish
    data, for a customer's own systems.


    **Authentication.** Every route takes an OAuth 2.0 access token for an API
    service account, as `Authorization: Bearer <token>`. Create the account in
    Cimento under Integrations, API access, then exchange its client ID and
    secret for a token at the token URL with the client credentials grant. A
    token lasts an hour and carries the scopes the account was given; each route
    says which it needs.


    **Requests.** Every route is a `GET`. A parameter that takes a list takes
    its values separated by commas. A parameter the route does not have, or one
    given twice, is refused.


    **Paging.** Paging differs by route and each says which it uses. Most lists
    take `limit` and `offset` and answer with `totalCount` and, while more
    remain, `nextOffset`. Two AutoPhish lists take a `cursor` and answer with
    `nextCursor`, with no total.


    **Rate limit.** Each service account may make a short burst of requests and
    then about one a second. Past that the answer is `429` with a `Retry-After`
    header, in seconds.


    **Errors.** Every error has one shape,
    `{"error":{"code":"...","message":"..."}}`.
  title: Cimento Analytics API
  version: '1'
servers:
  - url: https://api.cimento.app
security: []
tags:
  - description: >-
      AutoPhish, the tenant's one continuous phishing program: its settings, its
      results and what people did with its simulations.
    name: autophish
  - description: >-
      Phishing campaigns: the figures across them, and the campaigns and
      templates those figures can be filtered by.
    name: phishing
  - description: Training campaigns and the courses they assign.
    name: training
paths:
  /v1/training/campaigns:
    get:
      tags:
        - training
      summary: List training campaigns
      description: >-
        The tenant's training campaigns, latest start first, each with its name,
        course, status, dates and how many people it assigns. `query` searches
        campaign and course names; `status`, `courseId`, `startsFrom` and
        `startsBefore` narrow the list. Use a campaign's `trainingCampaignId` to
        read what it is set to. Pages with `limit` and `offset`: the answer has
        `totalCount` for the whole list and, while more remain, `nextOffset` to
        pass back as `offset`.
      operationId: listTrainingCampaigns
      parameters:
        - description: Words to find in campaign or course names
          in: query
          name: query
          required: false
          schema:
            type: string
        - description: >-
            Only campaigns in this state, judged as the web app's filter judges
            it
          in: query
          name: status
          required: false
          schema:
            enum:
              - draft
              - scheduled
              - active
              - completed
              - cancelled
            type: string
        - description: Only campaigns of this course
          in: query
          name: courseId
          required: false
          schema:
            format: uuid
            pattern: >-
              ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
            type: string
        - description: >-
            Only campaigns whose scheduledStartDate is on or after this: a day,
            YYYY-MM-DD, or a date and time with its offset
          in: query
          name: startsFrom
          required: false
          schema:
            pattern: >-
              ^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2}))?$
            type: string
        - description: >-
            Only campaigns whose scheduledStartDate is before this, a day or a
            date and time as startsFrom takes. For a period that ends with a
            day, the day after it
          in: query
          name: startsBefore
          required: false
          schema:
            pattern: >-
              ^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2}))?$
            type: string
        - description: >-
            An IANA time zone, such as Europe/London, in which a day given to
            startsFrom or startsBefore begins. UTC without it
          in: query
          name: timeZone
          required: false
          schema:
            type: string
        - description: How many to return, up to 100. Defaults to 20
          in: query
          name: limit
          required: false
          schema:
            default: 20
            maximum: 100
            minimum: 1
            type: integer
        - description: 'How many to skip: the nextOffset of the previous page'
          in: query
          name: offset
          required: false
          schema:
            minimum: 0
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchTrainingCampaignsResult'
          description: What was asked for.
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/InvalidToken'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
      security:
        - oauth2:
            - training_campaigns:view
components:
  schemas:
    SearchTrainingCampaignsResult:
      additionalProperties: false
      properties:
        campaigns:
          items:
            additionalProperties: false
            properties:
              appUrl:
                description: Where the web app shows this campaign
                type: string
              audience:
                additionalProperties: false
                description: >-
                  Who it reaches. Absent while it has no audience, and on a
                  campaign that targets targetGroups and targetDepartments
                  instead
                properties:
                  departmentNames:
                    description: >-
                      With departments, the departments by name. With new_hires,
                      the departments the new hires must be in, when it names
                      any
                    items:
                      type: string
                    type:
                      - 'null'
                      - array
                  emails:
                    description: With specific_employees, their email addresses
                    items:
                      type: string
                    type:
                      - 'null'
                      - array
                  groupId:
                    description: With existing_group, the ID of the group
                    type: string
                  quickPath:
                    description: >-
                      Which of the web app's audience choices:
                      specific_employees, departments, existing_group,
                      all_employees, new_hires, repeated_offender, high_risk or
                      advanced
                    type: string
                  ruleSummary:
                    description: With advanced, the rule as the web app words it
                    type: string
                  threshold:
                    description: >-
                      With repeated_offender, how many phishing simulations
                      someone failed in the window, at least
                    type: integer
                  unit:
                    description: 'The window''s unit: days, weeks or months'
                    type: string
                  value:
                    description: >-
                      How many units back the window goes: with new_hires, since
                      someone was hired, and with repeated_offender, for the
                      failures counted
                    type: integer
                required:
                  - quickPath
                type:
                  - 'null'
                  - object
              autoEnrollEnabled:
                description: >-
                  Whether people who join the audience after launch are enrolled
                  too
                type:
                  - 'null'
                  - boolean
              campaignFamilyId:
                description: >-
                  Shared by the campaigns made together, one for each course.
                  Absent for a campaign made alone
                type: string
              campaignName:
                type: string
              course:
                additionalProperties: false
                properties:
                  courseId:
                    type: string
                  courseName:
                    type: string
                required:
                  - courseId
                  - courseName
                type:
                  - 'null'
                  - object
              dueAfterUnit:
                description: days, weeks or months
                type: string
              dueAfterValue:
                type: integer
              dueAtTime:
                description: >-
                  With relative, the time of day the course comes due, in
                  dueAtTimezone, when one is set
                type: string
              dueAtTimezone:
                type: string
              dueDateMode:
                description: >-
                  When the course is due: fixed_date, on scheduledEndDate;
                  relative, dueAfterValue dueAfterUnit after each person is
                  enrolled; or evergreen, never
                type: string
              launchCohortDueDate:
                description: >-
                  With relative, when the people enrolled at launch are due
                  instead, so that only later ones go by dueAfterValue
                type: string
              notificationRules:
                description: >-
                  The messages it sends by itself. Absent for a service account,
                  which cannot be given the scope they need
                items:
                  additionalProperties: false
                  properties:
                    absoluteTime:
                      description: With timingType absolute, the moment it sends
                      type: string
                    assignmentStatus:
                      description: >-
                        Only the assigned people in these states, or their
                        managers: enrolled, in_progress, overdue or completed.
                        Absent for everyone
                      items:
                        type: string
                      type:
                        - 'null'
                        - array
                    channel:
                      description: email or slack
                      type: string
                    enabled:
                      description: >-
                        Whether it sends. One that is off is kept and sends
                        nothing
                      type: boolean
                    notificationConfigId:
                      type: string
                    offsetDays:
                      description: Days from relativeTo, negative for before it
                      type:
                        - 'null'
                        - integer
                    offsetHours:
                      description: Hours added to offsetDays
                      type: integer
                    recipientType:
                      description: >-
                        employee for the people assigned, manager for their
                        managers, or admin
                      type: string
                    recurrenceDaysOfWeek:
                      description: >-
                        The days one that repeats sends on, 0 for Sunday. Absent
                        for every day
                      items:
                        type: integer
                      type:
                        - 'null'
                        - array
                    recurrenceTimeOfDay:
                      description: On one that repeats, the time of day it sends, HH:MM
                      type: string
                    recurrenceTimezone:
                      description: >-
                        The zone recurrenceTimeOfDay is in for someone who has
                        none of their own
                      type: string
                    relativeTo:
                      description: >-
                        With timingType relative, what offsetDays counts from:
                        start_date, end_date or assignment_date
                      type: string
                    rule:
                      additionalProperties: false
                      description: >-
                        The rule as the rule builder on the campaign page shows
                        it
                      properties:
                        audiencePreset:
                          type: string
                        customTiming:
                          additionalProperties: false
                          properties:
                            offsetDays:
                              description: How many days
                              type: integer
                            offsetDirection:
                              description: Whether that is before or after the date
                              type: string
                            relativeTo:
                              description: >-
                                The date: start_date for the campaign's start,
                                or end_date for the date the course is due
                              type: string
                          required:
                            - offsetDays
                            - offsetDirection
                            - relativeTo
                          type:
                            - 'null'
                            - object
                        exact:
                          description: >-
                            False for a rule saved some other way than on the
                            campaign's page, which these choices describe only
                            roughly: it can be removed but not edited
                          type: boolean
                        recurrenceDaysOfWeek:
                          items:
                            type: integer
                          type:
                            - 'null'
                            - array
                        recurrenceTimeOfDay:
                          type: string
                        timingPreset:
                          type: string
                      required:
                        - timingPreset
                        - audiencePreset
                        - exact
                      type:
                        - 'null'
                        - object
                    templateId:
                      description: >-
                        The notification template it sends. A rule without one
                        sends nothing
                      type: string
                    templateName:
                      type: string
                    timingType:
                      description: immediate, relative or absolute
                      type: string
                    title:
                      description: A custom message's name. A standard one has none
                      type: string
                    triggerType:
                      description: >-
                        What sets it off: campaign_start, assignment,
                        completion, overdue, cancellation, or reminder for one
                        that goes by its timing
                      type: string
                  required:
                    - notificationConfigId
                    - enabled
                    - triggerType
                    - recipientType
                    - channel
                  type: object
                type:
                  - 'null'
                  - array
              recurrence:
                additionalProperties: false
                description: >-
                  Whether it runs once or assigns the course again to whoever in
                  its audience has not completed it in the last value units.
                  Absent, and audience with it, for a service account: both need
                  a scope none can be given
                properties:
                  mode:
                    description: one_time or recurring
                    type: string
                  unit:
                    description: With recurring, days, weeks or months
                    type: string
                  value:
                    description: With recurring, how many units it goes by
                    type: integer
                required:
                  - mode
                type:
                  - 'null'
                  - object
              scheduledEndDate:
                type: string
              scheduledStartDate:
                type: string
              status:
                description: >-
                  The stored status. The web app also goes by the dates, so it
                  can show another
                type: string
              targetDepartments:
                description: The departments it targets by ID when it has no targetGroupId
                items:
                  type: string
                type:
                  - 'null'
                  - array
              targetGroupId:
                description: >-
                  The ID of the group that holds its audience. Absent while it
                  has no audience
                type: string
              targetGroups:
                description: The groups it targets by ID when it has no targetGroupId
                items:
                  type: string
                type:
                  - 'null'
                  - array
              totalAssigned:
                type: integer
              trainingCampaignId:
                type: string
              updatedAt:
                description: When it last changed
                type: string
            required:
              - trainingCampaignId
              - status
              - totalAssigned
              - updatedAt
            type: object
          type:
            - 'null'
            - array
        nextOffset:
          description: The offset of the next page. Absent on the last
          type:
            - 'null'
            - integer
        totalCount:
          description: How many campaigns match, across every page
          type: integer
      required:
        - campaigns
        - totalCount
      type: object
    Error:
      additionalProperties: false
      description: What every error answers with.
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              description: >-
                Which error it is, one of `invalid_request`, `invalid_token`,
                `insufficient_scope`, `not_found`, `rate_limited`,
                `unavailable`. Stable: branch on this, and treat one you do not
                know as the status alone.
              type: string
            message:
              description: >-
                What went wrong, for a developer to read. The wording can
                change.
              type: string
          required:
            - code
            - message
          type: object
      required:
        - error
      type: object
  responses:
    InvalidRequest:
      content:
        application/json:
          example:
            error:
              code: invalid_request
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        A parameter is unknown, repeated, empty or not what the route takes. The
        message names it and says what is wrong.
    InvalidToken:
      content:
        application/json:
          example:
            error:
              code: invalid_token
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        No access token was sent, or it is expired or not valid. Get another
        from the token URL.
      headers:
        WWW-Authenticate:
          description: Always `Bearer error="invalid_token"`.
          schema:
            type: string
    InsufficientScope:
      content:
        application/json:
          example:
            error:
              code: insufficient_scope
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The token lacks a scope the route needs, which the message then names,
        or the account may not read what was asked for.
    NotFound:
      content:
        application/json:
          example:
            error:
              code: not_found
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        Nothing has that ID, or the tenant does not have the feature the route
        belongs to.
    RateLimited:
      content:
        application/json:
          example:
            error:
              code: rate_limited
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The service account is making requests too quickly. Wait the seconds
        `Retry-After` gives, then try again.
      headers:
        Retry-After:
          description: How many seconds to wait before the next request.
          schema:
            type: integer
    Unavailable:
      content:
        application/json:
          example:
            error:
              code: unavailable
              message: ...
          schema:
            $ref: '#/components/schemas/Error'
      description: The service could not answer just now. Try again shortly.
  securitySchemes:
    oauth2:
      description: >-
        An API service account's access token, from the client credentials
        grant.
      flows:
        clientCredentials:
          scopes:
            phishing:admin: AutoPhish activity and settings
            phishing_analytics:view: Phishing analytics
            phishing_analytics:view_employee_data: Phishing results for named employees
            phishing_campaigns:view: Phishing campaigns
            phishing_templates:view: Phishing templates
            training_campaigns:view: Training campaigns
            training_courses:view: Training courses
          tokenUrl: https://api.cimento.app/oauth2/token
      type: oauth2

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.