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

# Open a draft pull request for a post

> Exports a saved blog post or changelog to a draft GitHub pull request, using the repository's configured content path, site metadata and image handling, the same as the dashboard. Always opens a pull request, even for repositories set to publish directly, and never merges it. Calling it again for the same post and repository updates its open pull request instead of opening another.



## OpenAPI

````yaml https://api.usenotra.com/openapi.json post /v1/posts/{postId}/pull-request
openapi: 3.1.1
info:
  title: Notra API
  version: 1.0.0
  description: >-
    OpenAPI schema for Notra content endpoints. Use GET /v1/status for public
    reachability. Error responses include recovery guidance. Breaking changes
    ship under a new major path; deprecated operations send Deprecation and
    Sunset headers at least 90 days before removal.
servers:
  - url: https://api.usenotra.com
    description: Production
  - url: https://demo-api.usenotra.com
    description: >-
      Sandbox with sample data. Get a free sandbox key at demo.usenotra.com, no
      signup needed
security:
  - BearerAuth: []
tags:
  - name: Webhooks
    description: Manage outbound webhook subscriptions and delivery history.
  - name: Discovery
    description: Public API status and authenticated workspace discovery.
  - name: Content
    description: >-
      Manage posts, brand identities, and GitHub or Linear integrations, and
      queue content generation. Organization is inferred from the API key
      (identity.externalId).
  - name: Schedules
    description: >-
      Manage scheduled content generation. Organization is inferred from the API
      key (identity.externalId).
  - name: Event Triggers
    description: >-
      Manage event-based content generation triggered by GitHub webhooks.
      Organization is inferred from the API key (identity.externalId).
  - name: Chats
    description: >-
      Manage chat sessions. Organization is inferred from the API key
      (identity.externalId).
  - name: Skills
    description: >-
      Manage reusable writing skills. Organization is inferred from the API key
      (identity.externalId).
  - name: Feedback
    description: >-
      Collect and triage feedback submitted by AI agents. Agents post to the
      organization's feedback URL without credentials; reading and triage
      require an API key with feedback.read or feedback.write.
  - name: GEO
    description: >-
      Manage generative engine optimization: projects, tracking settings,
      prompts, prompt sequences, competitors, scans, visibility reads, content
      gaps and briefs, agent readiness and AI traffic. Project-scoped endpoints
      require the GEO plan entitlement in addition to their scope;
      organization-level ingest endpoints require only the traffic scope.
  - name: Sites
    description: >-
      Notra Sites are hosted blogs and changelogs built from a GitHub
      repository. Read Sites and their deployments, start builds, preview posts
      on a Site, open pull requests that publish posts to it, and manage
      blog.json authors and the author page through staged Design changes.
      Domains, settings, rollbacks and deletion stay in the dashboard.
externalDocs:
  description: Notra API versioning and deprecation policy
  url: https://www.usenotra.com/docs/api/versioning
paths:
  /v1/posts/{postId}/pull-request:
    post:
      tags:
        - Content
      summary: Open a draft pull request for a post
      description: >-
        Exports a saved blog post or changelog to a draft GitHub pull request,
        using the repository's configured content path, site metadata and image
        handling, the same as the dashboard. Always opens a pull request, even
        for repositories set to publish directly, and never merges it. Calling
        it again for the same post and repository updates its open pull request
        instead of opening another.
      operationId: createPostPullRequest
      parameters:
        - schema:
            type: string
            minLength: 1
            pattern: ^[A-Za-z0-9_-]{1,100}$
            example: post_123
          required: true
          in: path
          name: postId
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                integrationId:
                  type: string
                  minLength: 1
                  description: >-
                    GitHub integration ID from GET /v1/integrations to open the
                    pull request in.
                  example: integration_1
                github:
                  type: object
                  properties:
                    owner:
                      type: string
                      minLength: 1
                    repo:
                      type: string
                      minLength: 1
                  required:
                    - owner
                    - repo
                  description: >-
                    Connected repository by owner and name, instead of
                    integrationId.
                  example:
                    owner: usenotra
                    repo: notra
              description: >-
                Where to open the pull request. Omit both fields when the
                organization has exactly one connected GitHub repository.
      responses:
        '200':
          description: Draft pull request opened or updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization:
                    type: object
                    properties:
                      id:
                        type: string
                      slug:
                        type: string
                      name:
                        type: string
                      logo:
                        type:
                          - string
                          - 'null'
                    required:
                      - id
                      - slug
                      - name
                      - logo
                  pullRequest:
                    type: object
                    properties:
                      number:
                        type: integer
                        exclusiveMinimum: 0
                      url:
                        type: string
                        format: uri
                      branchName:
                        type: string
                      path:
                        type: string
                        description: Repository path of the post file on the branch.
                      operation:
                        type: string
                        enum:
                          - created
                          - updated
                        description: >-
                          created for a new draft pull request, updated when the
                          post's open pull request was refreshed instead.
                    required:
                      - number
                      - url
                      - branchName
                      - path
                      - operation
                required:
                  - organization
                  - pullRequest
        '400':
          description: >-
            Invalid request, no matching repository, or the post is not a blog
            post or changelog
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Post or organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Rate limit exceeded. This endpoint allows 60 requests per 1 minute
            per API key.
          headers:
            RateLimit-Limit:
              description: Maximum requests allowed in the current window.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the current window resets.
              schema:
                type: integer
            Retry-After:
              description: Seconds the client should wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '502':
          description: GitHub could not prepare the pull request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Pull request export is unavailable or GitHub publishing is rate
            limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: The export timed out and may still complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        recovery:
          type: string
      required:
        - error
    RateLimitErrorResponse:
      type: object
      properties:
        error:
          type: string
        limit:
          type: integer
          minimum: 1
        remaining:
          type: integer
          minimum: 0
        reset:
          type: integer
      required:
        - error
        - limit
        - remaining
        - reset
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Send your API key in the Authorization header as Bearer API_KEY. Account
        API keys work in every workspace you belong to: send
        X-Notra-Organization-Id with the workspace id or slug to choose one.
        Workspace endpoints require it when you belong to more than one
        workspace; GET /v1/me/workspaces works without it. Organization keys
        only accept their own workspace there.

````

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