openapi: 3.1.0
info:
  title: Onset API
  description: RESTful API for managing milestones, releases, subscribers, and webhooks in Onset workspace.
  version: 1.0.0
  contact:
    name: Onset Support
    url: https://www.onset.io
    email: support@onset.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.onset.io/v1
    description: API V1

security:
  - bearerAuth: []
  - basicAuth: []

paths:
  /workspace:
    get:
      summary: Get workspace information
      description: >-
        Retrieve information about the current authenticated workspace,
        including its ID, name, slug, public page URL, and the configured
        release change types and roadmap status types
      tags:
        - Workspace
      responses:
        '200':
          description: Workspace information retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /milestones:
    get:
      summary: List milestones
      description: Retrieve a paginated list of milestones with optional filtering by status, visibility, project, and other criteria
      tags:
        - Milestones
      parameters:
        - name: offset
          in: query
          description: Number of items to skip for pagination (0-based)
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
            example: 0
        - name: limit
          in: query
          description: Maximum number of items to return per page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
            example: 25
        - name: slug
          in: query
          description: Filter by milestone slug (exact match)
          schema:
            type: string
            example: 'user-authentication-v2'
        - name: is_public
          in: query
          description: Filter by public visibility status
          schema:
            type: boolean
            example: true
        - name: status
          in: query
          description: Filter by milestone status
          schema:
            type: string
        - name: project_id
          in: query
          description: Filter by project ID
          schema:
            type: string
      responses:
        '200':
          description: List of milestones retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Milestone'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /milestones/{id}:
    get:
      summary: Get milestone by ID
      description: Retrieve a specific milestone by its ID
      tags:
        - Milestones
      parameters:
        - name: id
          in: path
          required: true
          description: Milestone ID
          schema:
            type: string
      responses:
        '200':
          description: Milestone retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Milestone'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update milestone
      description: Update an existing milestone
      tags:
        - Milestones
      parameters:
        - name: id
          in: path
          required: true
          description: Milestone ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMilestoneRequest'
      responses:
        '200':
          description: Milestone updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Milestone'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete milestone
      description: Delete a milestone by its ID
      tags:
        - Milestones
      parameters:
        - name: id
          in: path
          required: true
          description: Milestone ID
          schema:
            type: string
      responses:
        '200':
          description: Milestone deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /releases:
    get:
      summary: List releases
      description: Retrieve a list of releases with optional filtering
      tags:
        - Releases
      parameters:
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: slug
          in: query
          description: Filter by release slug
          schema:
            type: string
        - name: is_public
          in: query
          description: Filter by public visibility
          schema:
            type: boolean
        - name: status
          in: query
          description: Filter by release status
          schema:
            type: string
            enum: [DRAFT, RELEASED]
        - name: project_id
          in: query
          description: Filter by project ID
          schema:
            type: string
        - name: label_ids
          in: query
          description: >-
            Comma-separated label IDs. Returns releases carrying any of the
            given labels.
          schema:
            type: string
          example: clx1abc,clx2def
      responses:
        '200':
          description: List of releases retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Release'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

    post:
      summary: Create a new release
      description: >-
        Create a new release in the workspace. Releases are always created as
        drafts — use POST /releases/{id}/publish to publish or schedule one.
      tags:
        - Releases
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReleaseRequest'
      responses:
        '201':
          description: Release created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /releases/{id}:
    get:
      summary: Get release by ID
      description: Retrieve a specific release by its ID
      tags:
        - Releases
      parameters:
        - name: id
          in: path
          required: true
          description: Release ID
          schema:
            type: string
      responses:
        '200':
          description: Release retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update release
      description: >-
        Update the content of an existing release. Cannot publish or unpublish —
        use POST /releases/{id}/publish for that.
      tags:
        - Releases
      parameters:
        - name: id
          in: path
          required: true
          description: Release ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateReleaseRequest'
      responses:
        '200':
          description: Release updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete release
      description: Delete a release by its ID
      tags:
        - Releases
      parameters:
        - name: id
          in: path
          required: true
          description: Release ID
          schema:
            type: string
      responses:
        '200':
          description: Release deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /releases/{id}/publish:
    post:
      summary: Publish release
      description: >-
        Publish a draft or scheduled release to the changelog, either
        immediately or at a future date. Use this to publish a scheduled release
        early, or to move a scheduled release to a different date. Returns 400
        if the release is already published.
      tags:
        - Releases
      parameters:
        - name: id
          in: path
          required: true
          description: Release ID
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishReleaseRequest'
      responses:
        '200':
          description: Release published successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /subscribers:
    get:
      summary: List subscribers
      description: >-
        Retrieve a list of subscribers, newest first, with optional filtering
        by subscriber list
      tags:
        - Subscribers
      parameters:
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: list_ids
          in: query
          description: >-
            Comma-separated subscriber list IDs. Returns subscribers belonging
            to any of the given lists.
          schema:
            type: string
          example: clx1abc,clx2def
      responses:
        '200':
          description: List of subscribers retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Subscriber'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

    post:
      summary: Create a new subscriber
      description: Create a new subscriber in the workspace
      tags:
        - Subscribers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriberRequest'
      responses:
        '201':
          description: Subscriber created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscriber'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /subscribers/{id}:
    get:
      summary: Get subscriber by ID
      description: Retrieve a specific subscriber by their ID
      tags:
        - Subscribers
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber ID
          schema:
            type: string
      responses:
        '200':
          description: Subscriber retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscriber'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update subscriber
      description: Update an existing subscriber
      tags:
        - Subscribers
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSubscriberRequest'
      responses:
        '200':
          description: Subscriber updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscriber'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete subscriber
      description: Delete a subscriber by their ID
      tags:
        - Subscribers
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber ID
          schema:
            type: string
      responses:
        '200':
          description: Subscriber deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /subscriber-lists:
    get:
      summary: List subscriber lists
      description: Retrieve a list of subscriber lists
      tags:
        - Subscriber Lists
      parameters:
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
      responses:
        '200':
          description: List of subscriber lists retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SubscriberList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

    post:
      summary: Create a new subscriber list
      description: Create a new subscriber list in the workspace
      tags:
        - Subscriber Lists
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriberListRequest'
      responses:
        '201':
          description: Subscriber list created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriberList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /subscriber-lists/{id}:
    get:
      summary: Get subscriber list by ID
      description: Retrieve a specific subscriber list by its ID
      tags:
        - Subscriber Lists
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber list ID
          schema:
            type: string
      responses:
        '200':
          description: Subscriber list retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriberList'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update subscriber list
      description: Update an existing subscriber list
      tags:
        - Subscriber Lists
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber list ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSubscriberListRequest'
      responses:
        '200':
          description: Subscriber list updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriberList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete subscriber list
      description: Delete a subscriber list by its ID
      tags:
        - Subscriber Lists
      parameters:
        - name: id
          in: path
          required: true
          description: Subscriber list ID
          schema:
            type: string
      responses:
        '200':
          description: Subscriber list deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /webhooks:
    get:
      summary: List webhooks
      description: Retrieve a list of webhooks
      tags:
        - Webhooks
      parameters:
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
      responses:
        '200':
          description: List of webhooks retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Webhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

    post:
      summary: Create a new webhook
      description: Create a new webhook in the workspace
      tags:
        - Webhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '201':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /webhooks/{id}:
    get:
      summary: Get webhook by ID
      description: Retrieve a specific webhook by its ID
      tags:
        - Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Webhook ID
          schema:
            type: string
      responses:
        '200':
          description: Webhook retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update webhook
      description: Update an existing webhook
      tags:
        - Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Webhook ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookRequest'
      responses:
        '200':
          description: Webhook updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete webhook
      description: Delete a webhook by its ID
      tags:
        - Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Webhook ID
          schema:
            type: string
      responses:
        '200':
          description: Webhook deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /incoming-webhooks:
    get:
      summary: List incoming webhooks
      description: Retrieve a list of incoming webhooks
      tags:
        - Incoming Webhooks
      parameters:
        - name: offset
          in: query
          description: Number of items to skip
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
        - name: limit
          in: query
          description: Maximum number of items to return
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
        - name: type
          in: query
          description: >-
            Filter by incoming webhook type. `MILESTONE` can still be filtered
            on so you can find existing milestone webhooks, but new ones can no
            longer be created and calls to them return 410.
          schema:
            type: string
            enum: [RELEASE, MILESTONE, SUBSCRIBER]
            description: Type of incoming webhook
      responses:
        '200':
          description: List of incoming webhooks retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/IncomingWebhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

    post:
      summary: Create a new incoming webhook
      description: Create a new incoming webhook in the workspace
      tags:
        - Incoming Webhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateIncomingWebhookRequest'
      responses:
        '201':
          description: Incoming webhook created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IncomingWebhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /incoming-webhooks/{id}:
    get:
      summary: Get incoming webhook by ID
      description: Retrieve a specific incoming webhook by its ID
      tags:
        - Incoming Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Incoming webhook ID
          schema:
            type: string
      responses:
        '200':
          description: Incoming webhook retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IncomingWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    patch:
      summary: Update incoming webhook
      description: Update an existing incoming webhook
      tags:
        - Incoming Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Incoming webhook ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateIncomingWebhookRequest'
      responses:
        '200':
          description: Incoming webhook updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IncomingWebhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

    delete:
      summary: Delete incoming webhook
      description: Delete an incoming webhook by its ID
      tags:
        - Incoming Webhooks
      parameters:
        - name: id
          in: path
          required: true
          description: Incoming webhook ID
          schema:
            type: string
      responses:
        '200':
          description: Incoming webhook deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'

  /projects:
    get:
      summary: List projects
      description: Retrieve a paginated list of projects in the workspace
      tags:
        - Projects
      parameters:
        - name: offset
          in: query
          description: Number of items to skip for pagination (0-based)
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
            example: 0
        - name: limit
          in: query
          description: Maximum number of items to return per page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
            example: 25
        - name: slug
          in: query
          description: Filter by project slug (exact match)
          schema:
            type: string
            example: 'mobile-app'
      responses:
        '200':
          description: List of projects retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Project'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /labels:
    get:
      summary: List labels
      description: Retrieve a paginated list of labels in the workspace
      tags:
        - Labels
      parameters:
        - name: offset
          in: query
          description: Number of items to skip for pagination (0-based)
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
            example: 0
        - name: limit
          in: query
          description: Maximum number of items to return per page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
            example: 25
        - name: slug
          in: query
          description: Filter by label slug (exact match)
          schema:
            type: string
            example: 'bug-fix'
      responses:
        '200':
          description: List of labels retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Label'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

  /contributors:
    get:
      summary: List contributors
      description: Retrieve a paginated list of contributors (workspace members) that can be assigned to releases
      tags:
        - Contributors
      parameters:
        - name: offset
          in: query
          description: Number of items to skip for pagination (0-based)
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 0
            example: 0
        - name: limit
          in: query
          description: Maximum number of items to return per page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 10
            example: 25
      responses:
        '200':
          description: List of contributors retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Contributor'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

  schemas:
    Workspace:
      type: object
      properties:
        id:
          type: string
          description: Unique workspace identifier
          example: 'ws_01hf8k4x7n9m2p3q5r8s9t0v1w'
        name:
          type: string
          description: Workspace name
          example: 'Acme Inc'
        slug:
          type: string
          description: Workspace slug
          example: 'acme-inc'
        url:
          type: string
          format: uri
          description: Public changelog page URL for the workspace
        release_change_types:
          type: array
          description: Change types configured for releases in this workspace
          items:
            type: object
            properties:
              id:
                type: string
                description: Change type identifier
              title:
                type: string
                description: Change type label
                example: 'Added'
              color:
                type: string
                description: Change type color
                example: '#22c55e'
        roadmap_status_types:
          type: array
          description: Status types configured for roadmap milestones in this workspace
          items:
            type: object
            properties:
              id:
                type: string
                description: Status identifier
              title:
                type: string
                description: Status label
                example: 'In progress'
              color:
                type: string
                description: Status color
                example: '#3b82f6'
              stage:
                type: string
                description: Stage this status maps to
                enum: [BACKLOG, PLANNED, IN_PROGRESS, COMPLETED, CANCELED]

    Milestone:
      type: object
      properties:
        id:
          type: string
          description: Unique milestone identifier
        number:
          type: integer
          description: Sequential milestone number
        title:
          type: string
          description: Milestone title
        body:
          type: string
          description: Milestone description/body content (HTML formatted)
        slug:
          type: string
          description: URL-friendly milestone identifier
        status:
          type: string
          description: Current milestone status
        stage:
          type: string
          description: Current milestone stage
        is_public:
          type: boolean
          description: Whether milestone is publicly visible
        upvote_count:
          type: integer
          description: Number of votes for this milestone
        project:
          allOf:
            - $ref: '#/components/schemas/Project'
            - nullable: true
        labels:
          type: array
          items:
            $ref: '#/components/schemas/Label'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        started_at:
          type: string
          format: date-time
          nullable: true
          description: When the milestone moved into progress
        ended_at:
          type: string
          format: date-time
          nullable: true
          description: When the milestone was completed or canceled
        created_at:
          type: string
          format: date-time
          description: When the milestone was created
        updated_at:
          type: string
          format: date-time
          description: When the milestone was last updated

    Release:
      type: object
      properties:
        id:
          type: string
          description: Unique release identifier
        title:
          type: string
          description: Release title
        body:
          type: string
          description: Release description/body content (HTML formatted)
        slug:
          type: string
          description: URL-friendly release identifier
        status:
          type: string
          enum: [DRAFT, SCHEDULED, RELEASED]
          description: Current release status
        version:
          type: string
          nullable: true
          description: Release version
        is_pinned:
          type: boolean
          description: Whether release is pinned
        is_public:
          type: boolean
          description: Whether release is publicly visible
        is_pre_release:
          type: boolean
          description: Whether this is a pre-release
        summary:
          type: string
          nullable: true
          description: AI generated summary of the release
        hero:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                type:
                  type: string
                  enum: [image, video]
                url:
                  type: string
                  format: uri
          description: Hero image/video for the release
        changes:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Change type title, e.g. "Fixed"
              color:
                type: string
                description: Badge colour (hex code)
              content:
                type: string
                nullable: true
                description: Change content (HTML formatted)
          description: List of changes in this release
        project:
          allOf:
            - $ref: '#/components/schemas/Project'
            - nullable: true
        labels:
          type: array
          items:
            $ref: '#/components/schemas/Label'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        contributors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Contributor ID
              name:
                type: string
                description: Contributor name
              avatar_url:
                type: string
                format: uri
                description: Contributor avatar URL
          description: List of contributors to this release
        scheduled_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the release is scheduled to publish. Only set while status is
            SCHEDULED.
        released_at:
          type: string
          format: date-time
          nullable: true
          description: When the release was released
        created_at:
          type: string
          format: date-time
          description: When the release was created
        updated_at:
          type: string
          format: date-time
          description: When the release was last updated

    Subscriber:
      type: object
      properties:
        id:
          type: string
          description: Unique subscriber identifier
        email:
          type: string
          format: email
          description: Subscriber email address
        lists:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Unique list identifier
              name:
                type: string
                description: List name
          description: Lists the subscriber belongs to
        created_at:
          type: string
          format: date-time
          description: When the subscriber was created
        updated_at:
          type: string
          format: date-time
          description: When the subscriber was last updated

    Project:
      type: object
      properties:
        id:
          type: string
          description: Unique project identifier
        name:
          type: string
          description: Project name
        slug:
          type: string
          description: Project slug

    Contributor:
      type: object
      properties:
        id:
          type: string
          description: Unique contributor identifier
        name:
          type: string
          nullable: true
          description: Contributor name
        avatar_url:
          type: string
          nullable: true
          description: URL of the contributor's avatar image

    Webhook:
      type: object
      properties:
        id:
          type: string
          description: Unique webhook identifier
        name:
          type: string
          description: Webhook name
        url:
          type: string
          format: uri
          description: Webhook URL endpoint
        events:
          type: object
          additionalProperties:
            type: boolean
          description: Webhook event subscriptions
          example:
            'release.created': true
            'release.updated': true
            'release.deleted': false
            'release.published': true
            'release.scheduled': false
            'release.reverted': false
            'release.reacted': false
            'release.unreacted': false
            'milestone.created': true
            'milestone.updated': true
            'milestone.deleted': false
            'milestone.upvoted': false
            'milestone.downvoted': false
            'milestone.archived': false
            'milestone.unarchived': false
            'subscriber.created': false
            'subscriber.updated': false
            'subscriber.deleted': false
            'subscriber.unsubscribed': false
        last_triggered_at:
          type: string
          format: date-time
          nullable: true
          description: When the webhook was last triggered
        created_at:
          type: string
          format: date-time
          description: When the webhook was created
        updated_at:
          type: string
          format: date-time
          description: When the webhook was last updated

    Label:
      type: object
      properties:
        id:
          type: string
          description: Unique label identifier
        name:
          type: string
          description: Label name
        slug:
          type: string
          description: Label slug
        color:
          type: string
          description: Label color (hex code)

    Attachment:
      type: object
      discriminator:
        propertyName: type
      properties:
        id:
          type: string
          description: Unique attachment identifier
        type:
          type: string
          enum: [FILE, LINK]
          description: Type of attachment
      oneOf:
        - $ref: '#/components/schemas/FileAttachment'
        - $ref: '#/components/schemas/LinkAttachment'

    FileAttachment:
      type: object
      properties:
        type:
          type: string
          enum: [FILE]
        content:
          type: object
          properties:
            title:
              type: string
              description: File title
            url:
              type: string
              description: File URL path
            size:
              type: integer
              description: File size in bytes
            type:
              type: string
              description: MIME type of the file

    LinkAttachment:
      type: object
      properties:
        type:
          type: string
          enum: [LINK]
        content:
          type: object
          properties:
            title:
              type: string
              nullable: true
              description: Link title
            url:
              type: string
              format: uri
              description: Link URL

    SubscriberList:
      type: object
      properties:
        id:
          type: string
          description: Unique list identifier
        name:
          type: string
          description: List name
        subscriber_count:
          type: integer
          description: Number of subscribers in the list
        created_at:
          type: string
          format: date-time
          description: When the list was created
        updated_at:
          type: string
          format: date-time
          description: When the list was last updated

    CreateSubscriberListRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 50
          description: Subscriber list name

    UpdateSubscriberListRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 50
          description: Subscriber list name

    UpdateMilestoneRequest:
      type: object
      description: >-
        Partial update. Every field is optional and any field you omit is left
        unchanged. Send an explicit empty array to clear `label_ids` or
        `attachments`.
      properties:
        title:
          type: string
          minLength: 3
          maxLength: 255
          description: Milestone title
        body:
          type: string
          description: Milestone description/body content
        status:
          type: string
          description: Milestone status ID
        slug:
          type: string
          minLength: 3
          maxLength: 255
          pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$'
          description: URL-friendly milestone identifier
        is_public:
          type: boolean
          description: Whether milestone should be publicly visible
        project_id:
          type: string
          nullable: true
          description: ID of the project this milestone belongs to
        label_ids:
          type: array
          items:
            type: string
          description: Array of label IDs to attach to the milestone
        attachments:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/CreateFileAttachmentRequest'
              - $ref: '#/components/schemas/CreateLinkAttachmentRequest'
          description: Array of attachments to include

    CreateReleaseRequest:
      type: object
      properties:
        title:
          type: string
          minLength: 3
          maxLength: 255
          description: Release title
        body:
          type: string
          description: Release description/body content
        slug:
          type: string
          minLength: 3
          maxLength: 255
          pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$'
          description: URL-friendly release identifier
        is_public:
          type: boolean
          description: Whether release should be publicly visible
        project_id:
          type: string
          description: ID of the project this release belongs to
        label_ids:
          type: array
          items:
            type: string
          description: Array of label IDs to attach to the release
        contributor_ids:
          type: array
          items:
            type: string
          description: Array of contributor IDs to attach to the release
        attachments:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/CreateFileAttachmentRequest'
              - $ref: '#/components/schemas/CreateLinkAttachmentRequest'
          description: Array of attachments to include
        hero:
          type: object
          properties:
            type:
              type: string
              enum: [image, video]
            url:
              type: string
              format: uri
          required:
            - type
            - url
          description: >-
            Hero image/video for the release. Omit for no hero — `null` is not
            accepted.
        changes:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: >-
                  Title of one of the workspace's configured change types,
                  matched case-insensitively. The badge colour is resolved from
                  that type, so it is not accepted here. An unrecognised title
                  is rejected with the workspace's valid options.
              content:
                type: string
                nullable: true
                description: Change content
            required:
              - title
          description: List of changes in this release
        is_pinned:
          type: boolean
          description: Whether release should be pinned
        is_pre_release:
          type: boolean
          description: Whether this is a pre-release
        version:
          type: string
          nullable: true
          description: Release version
      required:
        - title
        - slug

    PublishReleaseRequest:
      type: object
      properties:
        status:
          type: string
          enum: [RELEASED, SCHEDULED]
          default: RELEASED
          description: >-
            RELEASED publishes the release immediately. SCHEDULED publishes it
            automatically at scheduled_at.
        scheduled_at:
          type: string
          format: date-time
          description: >-
            When to publish the release. Required when status is SCHEDULED, must
            be a future date, and requires a plan that includes scheduled
            releases.
          example: '2026-08-01T09:00:00.000Z'

    UpdateReleaseRequest:
      type: object
      description: >-
        Partial update. Every field is optional and any field you omit is left
        unchanged. Send an explicit empty array to clear `label_ids`,
        `contributor_ids`, `attachments` or `changes`.
      properties:
        title:
          type: string
          minLength: 3
          maxLength: 255
          description: Release title
        body:
          type: string
          description: Release description/body content
        slug:
          type: string
          minLength: 3
          maxLength: 255
          pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$'
          description: URL-friendly release identifier
        is_public:
          type: boolean
          description: Whether release should be publicly visible
        project_id:
          type: string
          nullable: true
          description: ID of the project this release belongs to
        label_ids:
          type: array
          items:
            type: string
          description: Array of label IDs to attach to the release
        contributor_ids:
          type: array
          items:
            type: string
          description: Array of contributor IDs to attach to the release
        attachments:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/CreateFileAttachmentRequest'
              - $ref: '#/components/schemas/CreateLinkAttachmentRequest'
          description: Array of attachments to include
        hero:
          type: object
          properties:
            type:
              type: string
              enum: [image, video]
            url:
              type: string
              format: uri
          required:
            - type
            - url
          description: >-
            Hero image/video for the release. Omit to leave the current hero
            unchanged. `null` is not accepted, and the hero cannot be removed
            through this endpoint.
        changes:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: >-
                  Title of one of the workspace's configured change types,
                  matched case-insensitively. The badge colour is resolved from
                  that type, so it is not accepted here. An unrecognised title
                  is rejected with the workspace's valid options.
              content:
                type: string
                nullable: true
                description: HTML formatted content
            required:
              - title
          description: List of changes in this release
        contributors:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              name:
                type: string
              avatar_url:
                type: string
                format: uri
            required:
              - id
              - name
              - avatar_url
          description: List of contributors to this release
        is_pinned:
          type: boolean
          description: Whether release should be pinned
        is_pre_release:
          type: boolean
          description: Whether this is a pre-release
        version:
          type: string
          nullable: true
          description: Release version

    CreateSubscriberRequest:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Subscriber email address
        list_ids:
          type: array
          items:
            type: string
            format: uuid
          description: Array of list IDs to subscribe to
      required:
        - email

    UpdateSubscriberRequest:
      type: object
      properties:
        list_ids:
          type: array
          items:
            type: string
            format: uuid
          description: Array of list IDs to subscribe to

    CreateWebhookRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 50
          description: Webhook name
          example: 'Production Deployment Hook'
        url:
          type: string
          format: uri
          description: Webhook URL endpoint
          example: 'https://api.example.com/webhooks/onset'
        events:
          type: object
          additionalProperties:
            type: boolean
          description: Webhook event subscriptions
          example:
            'release.created': true
            'release.updated': true
            'release.deleted': false
            'release.published': true
            'release.scheduled': false
            'release.reverted': false
            'release.reacted': true
            'release.unreacted': false
            'milestone.created': true
            'milestone.updated': true
            'milestone.deleted': false
            'milestone.upvoted': true
            'milestone.downvoted': false
            'milestone.archived': false
            'milestone.unarchived': false
            'subscriber.created': true
            'subscriber.updated': false
            'subscriber.deleted': false
            'subscriber.unsubscribed': false
      required:
        - name
        - url
        - events

    UpdateWebhookRequest:
      type: object
      description: >-
        Partial update. Every field is optional and any field you omit is left
        unchanged. If you send `events`, it must subscribe to at least one event.
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 50
          description: Webhook name
        url:
          type: string
          format: uri
          description: Webhook URL endpoint
        events:
          type: object
          additionalProperties:
            type: boolean
          description: Webhook event subscriptions
          example:
            'release.created': true
            'release.updated': true
            'release.deleted': false
            'release.published': true
            'release.scheduled': false
            'release.reverted': false
            'release.reacted': false
            'release.unreacted': false
            'milestone.created': true
            'milestone.updated': true
            'milestone.deleted': false
            'milestone.upvoted': false
            'milestone.downvoted': false
            'milestone.archived': false
            'milestone.unarchived': false
            'subscriber.created': false
            'subscriber.updated': false
            'subscriber.deleted': false
            'subscriber.unsubscribed': false

    IncomingWebhook:
      type: object
      properties:
        id:
          type: string
          description: Unique incoming webhook identifier
          example: 'iw_01hf8k4x7n9m2p3q5r8s9t0v1w'
        name:
          type: string
          description: Incoming webhook name
          example: 'New release trigger'
        type:
          type: string
          enum: [RELEASE, MILESTONE, SUBSCRIBER]
          description: Incoming webhook type
          example: 'RELEASE'
        isEnabled:
          type: boolean
          description: Indicates whether the incoming webhook is enabled
          example: true
        url:
          type: string
          format: uri
          description: Incoming webhook URL endpoint
          example: 'https://hooks.onset.io/v1/XXXX/XXX'
        lastTriggeredAt:
          type: string
          format: date-time
          nullable: true
          description: Timestamp of the last successful trigger
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp

    CreateIncomingWebhookRequest:
      type: object
      properties:
        name:
          type: string
          description: Incoming webhook name
          example: 'New release trigger'
        type:
          type: string
          enum: [RELEASE, SUBSCRIBER]
          description: >-
            Incoming webhook type. `MILESTONE` is no longer accepted — the
            roadmap is being deprecated and milestone webhooks return 410.
      required:
        - name
        - type

    UpdateIncomingWebhookRequest:
      type: object
      properties:
        name:
          type: string
          description: Incoming webhook name
          example: 'New release trigger'
        isEnabled:
          type: boolean
          description: Whether the incoming webhook should be enabled
      required:
        - name

    CreateFileAttachmentRequest:
      type: object
      properties:
        id:
          type: string
          description: Optional existing attachment ID for updates
        type:
          type: string
          enum: [FILE]
        content:
          type: object
          properties:
            title:
              type: string
              description: File title
            url:
              type: string
              description: File URL path
            size:
              type: integer
              description: File size in bytes
            type:
              type: string
              description: MIME type of the file
          required:
            - title
            - url
            - size
            - type
      required:
        - type
        - content

    CreateLinkAttachmentRequest:
      type: object
      properties:
        id:
          type: string
          description: Optional existing attachment ID for updates
        type:
          type: string
          enum: [LINK]
        content:
          type: object
          properties:
            title:
              type: string
              nullable: true
              description: Link title
            url:
              type: string
              format: uri
              description: Link URL
          required:
            - url
      required:
        - type
        - content

    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        details:
          type: object
          description: Additional error details
      required:
        - error

  responses:
    BadRequest:
      description: Bad request - Invalid input parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

    Unauthorized:
      description: Unauthorized - Invalid or missing authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

    NotFound:
      description: Not found - Resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

tags:
  - name: Workspace
    description: Workspace management operations
  - name: Milestones
    description: Milestone management operations
  - name: Projects
    description: Project read operations
  - name: Labels
    description: Label read operations
  - name: Contributors
    description: Contributor read operations
  - name: Releases
    description: Release management operations
  - name: Subscribers
    description: Subscriber management operations
  - name: Subscriber Lists
    description: Subscriber list management operations
  - name: Webhooks
    description: Webhook management operations
  - name: Incoming Webhooks
    description: Incoming webhook management operations
