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

# List user pull requests from GitHub or GitLab

> Retrieves pull requests for the authenticated user. Returns a structured response with github and gitlab properties, containing pull requests for each provider (or null if not connected/fetched).



## OpenAPI

````yaml get /users/{id}/pull-requests
openapi: 3.0.0
info:
  title: OST API
  description: OST API endpoints
  version: '0.1'
  contact: {}
servers:
  - url: https://api.opensource-together.com
    description: Backend server
security: []
tags:
  - name: ost
    description: ''
paths:
  /users/{id}/pull-requests:
    get:
      tags:
        - User
      summary: List user pull requests from GitHub or GitLab
      description: >-
        Retrieves pull requests for the authenticated user. Returns a structured
        response with github and gitlab properties, containing pull requests for
        each provider (or null if not connected/fetched).
      operationId: UserController_listUserPullRequests
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: provider
          required: false
          in: query
          description: >-
            Git provider (github or gitlab). If specified, only fetches from
            that provider. If not provided, fetches from all connected providers
            in parallel.
          schema:
            enum:
              - github
              - gitlab
            type: string
        - name: page
          required: false
          in: query
          description: Page number for pagination
          schema:
            type: number
        - name: per_page
          required: false
          in: query
          description: Number of pull requests per page
          schema:
            type: number
        - name: state
          required: false
          in: query
          description: 'Filter pull requests by state (default: all)'
          schema:
            enum:
              - open
              - closed
              - merged
              - all
            type: string
      responses:
        '200':
          description: Pull requests retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PullRequestsResponseSchema'
                  timestamp:
                    type: string
                    format: date-time
                    example: '2025-09-03T13:04:43.353Z'
                required:
                  - data
                  - timestamp
        '400':
          description: Invalid provider or not connected
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                  timestamp:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                  timestamp:
                    type: string
                    format: date-time
components:
  schemas:
    PullRequestsResponseSchema:
      type: object
      properties:
        github:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PullRequestPaginateSchema'
        gitlab:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PullRequestPaginateSchema'
      required:
        - github
        - gitlab
    PullRequestPaginateSchema:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/UserPullRequestSchema'
        pagination:
          $ref: '#/components/schemas/PullRequestPaginationSchema'
      required:
        - data
        - pagination
    UserPullRequestSchema:
      type: object
      properties:
        title:
          type: string
        repository:
          type: string
        owner:
          type: object
          nullable: true
        state:
          type: string
        draft:
          type: boolean
        number:
          type: number
        created_at:
          type: string
        updated_at:
          type: string
        closed_at:
          type: object
          nullable: true
        merged_at:
          type: object
          nullable: true
        url:
          type: string
        branch:
          $ref: '#/components/schemas/PullRequestBranchSchema'
      required:
        - title
        - repository
        - owner
        - state
        - draft
        - number
        - created_at
        - updated_at
        - closed_at
        - merged_at
        - url
        - branch
    PullRequestPaginationSchema:
      type: object
      properties:
        hasNextPage:
          type: boolean
        hasPreviousPage:
          type: boolean
      required:
        - hasNextPage
        - hasPreviousPage
    PullRequestBranchSchema:
      type: object
      properties:
        from:
          type: string
        to:
          type: string
      required:
        - from
        - to

````