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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/api-reference/attestation/attest-pull-request",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Attest pull request

> Add Pull-Request attestation to a trail with an optional attachment file.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json post /attestations/{org}/{flow_name}/trail/{trail_name}/pull_request
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /attestations/{org}/{flow_name}/trail/{trail_name}/pull_request:
    post:
      tags:
        - Attestation
      summary: Attest pull request
      description: >-
        Add Pull-Request attestation to a trail with an optional attachment
        file.
      operationId: >-
        post_pull_request_attestation_attestations__org___flow_name__trail__trail_name__pull_request_post
      parameters:
        - name: flow_name
          in: path
          required: true
          schema:
            type: string
            title: Flow Name
        - name: trail_name
          in: path
          required: true
          schema:
            type: string
            title: Trail Name
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_post_pull_request_attestation_attestations__org___flow_name__trail__trail_name__pull_request_post
      responses:
        '201':
          description: Creation Success
          content:
            application/json:
              schema: {}
        '400':
          description: Validation Error
        '404':
          description: Not Found
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    Body_post_pull_request_attestation_attestations__org___flow_name__trail__trail_name__pull_request_post:
      properties:
        data_json:
          $ref: '#/components/schemas/PullRequestAttestationPostInput'
          description: Attestation data in JSON format
        attachment_file:
          anyOf:
            - type: string
              contentMediaType: application/octet-stream
            - type: 'null'
          title: Attachment File
          description: 'Optional attachment file (max size: 10MB)'
      type: object
      required:
        - data_json
      title: >-
        Body_post_pull_request_attestation_attestations__org___flow_name__trail__trail_name__pull_request_post
    PullRequestAttestationPostInput:
      properties:
        attestation_name:
          type: string
          pattern: ^[a-zA-Z0-9\-_,]+$
          title: Attestation Name
        origin_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Origin Url
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        artifact_fingerprint:
          anyOf:
            - type: string
              pattern: ^[a-f0-9]{64}$
            - type: 'null'
          title: Artifact Fingerprint
        target_artifacts:
          anyOf:
            - items:
                type: string
                pattern: ^[a-zA-Z0-9\-_,]+$
              type: array
            - type: 'null'
          title: Target Artifacts
        git_commit_info:
          anyOf:
            - $ref: '#/components/schemas/GitCommit'
            - type: 'null'
        repo_info:
          anyOf:
            - $ref: '#/components/schemas/RepoInfoPostInput'
            - type: 'null'
        external_urls:
          anyOf:
            - patternProperties:
                ^[^=.]+$:
                  $ref: '#/components/schemas/ExternalAttachmentUrl'
              type: object
            - type: 'null'
          title: External Urls
        annotations:
          anyOf:
            - patternProperties:
                ^[A-Za-z0-9_-]+$:
                  type: string
              type: object
            - type: 'null'
          title: Annotations
        user_data:
          anyOf:
            - additionalProperties: true
              type: object
            - items: {}
              type: array
            - type: 'null'
          title: User Data
        git_provider:
          type: string
          enum:
            - github
            - gitlab
            - bitbucket
            - azure
          title: Git Provider
        pull_requests:
          items:
            anyOf:
              - $ref: '#/components/schemas/FoundPullRequestV1'
              - $ref: '#/components/schemas/FoundPullRequestV2'
          type: array
          title: Pull Requests
      additionalProperties: false
      type: object
      required:
        - attestation_name
        - git_provider
        - pull_requests
      title: PullRequestAttestationPostInput
      examples:
        - attestation_name: pr
          git_commit_info:
            author: Jon Smith <jon@smith.com>
            branch: main
            message: adding glorious commit
            sha1: ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6
            timestamp: 1750923680
            url: >-
              https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6
          git_provider: github
          pull_requests:
            - approvers:
                - author: Jon Doe
                  state: APPROVED
                  timestamp: 1750923266
              author: JonSmith
              commits:
                - author: Jon Smith <jon@smith.com>
                  author_username: JonSmith
                  branch: glorious-branch
                  message: Add glorious feature
                  sha: f387a894992f7991489680696abf8b72bf7875f1
                  timestamp: 1750851568
                  url: >-
                    https://github.com/org/repo/commit/f387a894992f7991489680696abf8b72bf7875f1
                - author: Jon Smith <jon@smith.com>
                  author_username: JonSmith
                  branch: glorious-branch
                  message: Update glorious feature
                  sha: 2d48854228633cca94f7f4a587b2172ebb01cf85
                  timestamp: 1750922905
              created_at: 1750851601
              head_ref: glorious-branch
              merge_commit: ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6
              merged_at: 1750923680
              state: MERGED
              title: Add glorious commit
              url: https://github.com/org/repo/pull/3497
          user_data: {}
    GitCommit:
      properties:
        sha1:
          type: string
          title: Sha1
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
        author:
          anyOf:
            - type: string
            - type: 'null'
          title: Author
        author_username:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Username
        branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Branch
        timestamp:
          anyOf:
            - type: number
            - type: 'null'
          title: Timestamp
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        parents:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Parents
      type: object
      required:
        - sha1
      title: GitCommit
    RepoInfoPostInput:
      properties:
        name:
          type: string
          title: Name
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        url:
          type: string
          title: Url
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        provider:
          anyOf:
            - type: string
              enum:
                - github
                - gitlab
                - bitbucket
                - azure-devops
                - circleci
            - type: 'null'
          title: Provider
      type: object
      required:
        - name
        - url
      title: RepoInfoPostInput
    FoundPullRequestV1:
      properties:
        url:
          type: string
          title: Url
        state:
          type: string
          title: State
        merge_commit:
          anyOf:
            - type: string
              pattern: ^[a-f0-9]{40}$
            - type: string
              const: ''
          title: Merge Commit
        approvers:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Approvers
      additionalProperties: false
      type: object
      required:
        - url
        - state
        - merge_commit
      title: FoundPullRequestV1
    FoundPullRequestV2:
      properties:
        url:
          type: string
          title: Url
        state:
          type: string
          title: State
        author:
          type: string
          title: Author
        title:
          type: string
          title: Title
        created_at:
          type: number
          title: Created At
        merged_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Merged At
        head_ref:
          type: string
          title: Head Ref
        merge_commit:
          anyOf:
            - type: string
              pattern: ^[a-f0-9]{40}$
            - type: 'null'
          title: Merge Commit
        approvers:
          anyOf:
            - items:
                $ref: '#/components/schemas/PullRequestApprover'
              type: array
            - type: 'null'
          title: Approvers
        commits:
          items:
            $ref: '#/components/schemas/GitCommit'
          type: array
          title: Commits
      additionalProperties: false
      type: object
      required:
        - url
        - state
        - author
        - title
        - created_at
        - head_ref
        - commits
      title: FoundPullRequestV2
    PullRequestApprover:
      properties:
        username:
          type: string
          title: Username
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        timestamp:
          anyOf:
            - type: number
            - type: 'null'
          title: Timestamp
      additionalProperties: false
      type: object
      required:
        - username
      title: PullRequestApprover
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````