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

# Price a pull request

> Same as the GET form, but you can send the PR’s facts as `pr`, so a PR opened since the last nightly ingest is priced too (its `headRef` and `commits` link the agent sessions). For a release PR, `carried` lists feature PRs it carries that the ingest has not seen yet. `pr` and `carried` are used only for executive callers; an API key reads as an executive. A person reads only their own PRs, and a release PR returns 403 for them. Read-only: nothing is written.



## OpenAPI

````yaml /openapi.json post /v1/ai-optimization/roi/pull-requests/cost
openapi: 3.1.0
info:
  title: nOps Public API
  version: 1.0.0
  description: >-
    Programmatic access to nOps cost, budgets, cost allocation, Explorer
    dashboards, AI optimization, MAP manager, business unit economics, contract
    tracker, seat tracking, reports, recommendations, feed, scheduled prompts,
    notifications, and the nOps Artifacts catalog. Authenticate with an API key
    (Bearer token). Available on Inform + Operate.
servers:
  - url: https://api.nops.io
    description: Production
security:
  - bearerApiKey: []
tags:
  - name: Recommendations
    description: Cost optimization recommendations.
  - name: Anomalies
    description: AWS cost anomaly detection.
  - name: Explorer
    description: Cost Explorer queries — summary, history, heatmap, and dimensions.
  - name: Budgets
    description: Budgets, planning grids, alerts, and exports.
  - name: Seat Tracking
    description: >-
      AI seat tracking projects — per-user spend, limits, provider
      configuration, limit requests, automation, and analytics.
  - name: Reports
    description: Saved reports — create, update, render, and send.
  - name: Feed
    description: Clara Feed runs and delivery history.
  - name: Scheduled prompts
    description: Scheduled Clara prompts and manual runs.
  - name: Notifications
    description: Schedule and manage notification deliveries.
  - name: Commitments
    description: Commitment inventory (reserved for future use).
  - name: Cost allocation
    description: Cost Allocation showbacks, rules, and spend analytics.
  - name: Explorer dashboards
    description: Explorer dashboard layouts and widgets.
  - name: AI optimization
    description: >-
      AI Optimization default dashboard, anomaly insights, daily AI model usage,
      and AI ROI (pull request cost and headline numbers).
  - name: MAP Manager
    description: AWS Migration Acceleration Program (MAP) project tracking.
  - name: Business unit economics
    description: Business unit economics models, units, and portfolio summaries.
  - name: Contract tracker
    description: Enterprise contract tracking and burndown analytics.
  - name: Artifacts
    description: >-
      nOps-curated Skills and Artifacts (HTML and Markdown files): list,
      details, file download, and preview image. Read-only.
  - name: AWS onboarding
    description: >-
      Register a new AWS account from infrastructure as code. Create-only: the
      key cannot read, change, or delete existing integrations.
paths:
  /v1/ai-optimization/roi/pull-requests/cost:
    post:
      tags:
        - AI optimization
      summary: Price a pull request
      description: >-
        Same as the GET form, but you can send the PR’s facts as `pr`, so a PR
        opened since the last nightly ingest is priced too (its `headRef` and
        `commits` link the agent sessions). For a release PR, `carried` lists
        feature PRs it carries that the ingest has not seen yet. `pr` and
        `carried` are used only for executive callers; an API key reads as an
        executive. A person reads only their own PRs, and a release PR returns
        403 for them. Read-only: nothing is written.
      operationId: priceAiRoiPullRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    GitHub pull request URL, e.g.
                    `https://github.com/acme/api/pull/123`.
                pr:
                  type: object
                  nullable: true
                  properties:
                    authorLogin:
                      type: string
                      description: >-
                        GitHub login of the PR's author (bot logins such as
                        `copilot-swe-agent[bot]` are accepted).
                    title:
                      type: string
                      nullable: true
                      maxLength: 500
                    createdAt:
                      type: string
                      nullable: true
                      description: ISO timestamp.
                    firstCommitAt:
                      type: string
                      nullable: true
                      description: ISO timestamp.
                    mergedAt:
                      type: string
                      nullable: true
                      description: ISO timestamp.
                    closedAt:
                      type: string
                      nullable: true
                      description: ISO timestamp.
                    additions:
                      type: integer
                      minimum: 0
                      maximum: 10000000
                    deletions:
                      type: integer
                      minimum: 0
                      maximum: 10000000
                    headRef:
                      type: string
                      nullable: true
                      maxLength: 255
                      description: >-
                        Branch the PR was opened from. With `commits`, links
                        agent sessions of a PR the nightly ingest has not seen
                        yet.
                    baseRef:
                      type: string
                      nullable: true
                      maxLength: 255
                      description: >-
                        Branch the PR merges into. With `headRef`, tells a
                        release PR from a feature PR.
                    commits:
                      type: array
                      items:
                        type: object
                        properties:
                          sha:
                            type: string
                            pattern: ^[0-9a-fA-F]{40}$
                            description: Full 40-character commit SHA.
                          authorEmail:
                            type: string
                            nullable: true
                            description: Git author email.
                          authorLogin:
                            type: string
                            nullable: true
                            description: GitHub login of the commit's author.
                        required:
                          - sha
                      maxItems: 250
                      description: The PR's commits, as GitHub lists them (at most 250).
                  required:
                    - authorLogin
                    - additions
                    - deletions
                  description: >-
                    What you know about the PR from GitHub. Used only for
                    executive callers (API keys read as executives); for anyone
                    else the facts come from the nightly ingest.
                carried:
                  type: array
                  nullable: true
                  items:
                    type: object
                    properties:
                      url:
                        type: string
                        description: GitHub pull request URL of a carried feature PR.
                      pr:
                        type: object
                        nullable: true
                        properties:
                          authorLogin:
                            type: string
                            description: >-
                              GitHub login of the PR's author (bot logins such
                              as `copilot-swe-agent[bot]` are accepted).
                          title:
                            type: string
                            nullable: true
                            maxLength: 500
                          createdAt:
                            type: string
                            nullable: true
                            description: ISO timestamp.
                          firstCommitAt:
                            type: string
                            nullable: true
                            description: ISO timestamp.
                          mergedAt:
                            type: string
                            nullable: true
                            description: ISO timestamp.
                          closedAt:
                            type: string
                            nullable: true
                            description: ISO timestamp.
                          additions:
                            type: integer
                            minimum: 0
                            maximum: 10000000
                          deletions:
                            type: integer
                            minimum: 0
                            maximum: 10000000
                          headRef:
                            type: string
                            nullable: true
                            maxLength: 255
                            description: >-
                              Branch the PR was opened from. With `commits`,
                              links agent sessions of a PR the nightly ingest
                              has not seen yet.
                          baseRef:
                            type: string
                            nullable: true
                            maxLength: 255
                            description: >-
                              Branch the PR merges into. With `headRef`, tells a
                              release PR from a feature PR.
                          commits:
                            type: array
                            items:
                              type: object
                              properties:
                                sha:
                                  type: string
                                  pattern: ^[0-9a-fA-F]{40}$
                                  description: Full 40-character commit SHA.
                                authorEmail:
                                  type: string
                                  nullable: true
                                  description: Git author email.
                                authorLogin:
                                  type: string
                                  nullable: true
                                  description: GitHub login of the commit's author.
                              required:
                                - sha
                            maxItems: 250
                            description: >-
                              The PR's commits, as GitHub lists them (at most
                              250).
                        required:
                          - authorLogin
                          - additions
                          - deletions
                        description: >-
                          What you know about the PR from GitHub. Used only for
                          executive callers (API keys read as executives); for
                          anyone else the facts come from the nightly ingest.
                    required:
                      - url
                  maxItems: 100
                  description: >-
                    For a release PR: the feature PRs it carries that the
                    nightly ingest has not seen yet (at most 100). Executives
                    only, like `pr`.
              required:
                - url
      responses:
        '200':
          description: Price a pull request
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    description: JSON object
                    additionalProperties: true
                required:
                  - data
        '401':
          description: Unauthorized — invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
              example:
                error:
                  code: forbidden_scope
                  message: 'API key is missing required scope: budgets:write'
                  request_id: 550e8400-e29b-41d4-a716-446655440000
        '403':
          description: Forbidden — insufficient permissions or entitlement
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
              example:
                error:
                  code: forbidden_scope
                  message: 'API key is missing required scope: budgets:write'
                  request_id: 550e8400-e29b-41d4-a716-446655440000
      security:
        - bearerApiKey: []
components:
  schemas:
    PublicApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
          required:
            - code
            - message
            - request_id
      required:
        - error
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: >-
        API key from Settings → Security → API Keys. Pass as `Authorization:
        Bearer YOUR_API_KEY`.

````

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