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

# Export Workspace Sync

> Export workspace workflow specs to a Git branch and optional PR.



## OpenAPI

````yaml https://platform.tracecat.com/api/openapi.json post /workspaces/{workspace_id}/workflows/sync/export
openapi: 3.1.0
info:
  title: Tracecat API
  summary: Tracecat API
  description: The open source AI automation platform for security teams and agents.
  termsOfService: >-
    https://docs.google.com/document/d/e/2PACX-1vQvDe3SoVAPoQc51MgfGCP71IqFYX_rMVEde8zC4qmBCec5f8PLKQRdxa6tsUABT8gWAR9J-EVs2CrQ/pub
  contact:
    name: Tracecat Founders
    email: founders@tracecat.com
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1'
servers:
  - url: /api
security: []
tags:
  - name: public
    description: Public facing endpoints
  - name: workflows
    description: Workflow management
  - name: actions
    description: Action management
  - name: triggers
    description: Workflow triggers
  - name: secrets
    description: Secret management
  - name: variables
    description: Workspace variable management
paths:
  /workspaces/{workspace_id}/workflows/sync/export:
    post:
      tags:
        - workflows
      summary: Export Workspace Sync
      description: Export workspace workflow specs to a Git branch and optional PR.
      operationId: workflows-export_workspace_sync
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceSyncExportRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceSyncExportResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyCookie: []
        - ServiceAccountApiKeyBearer: []
components:
  schemas:
    WorkspaceSyncExportRequest:
      properties:
        message:
          type: string
          minLength: 1
          title: Message
          description: Commit message for the export.
        branch:
          type: string
          title: Branch
          description: Target branch to commit to.
        create_pr:
          type: boolean
          title: Create Pr
          description: Whether to open a pull request for the commit.
          default: false
        pr_base_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Pr Base Branch
          description: Base branch for the pull request, if created.
        resources:
          anyOf:
            - items:
                $ref: '#/components/schemas/ResourceRef'
              type: array
            - type: 'null'
          title: Resources
          description: Specific resources to export, or ``None`` to export all.
        include_schedules:
          type: boolean
          title: Include Schedules
          description: Whether to include workflow schedules in the export.
          default: false
      type: object
      required:
        - message
        - branch
      title: WorkspaceSyncExportRequest
      description: Request to commit selected workspace resources to a Git branch.
    WorkspaceSyncExportResult:
      properties:
        commit:
          $ref: '#/components/schemas/CommitInfo'
          description: Metadata for the commit that was created.
        files:
          items:
            type: string
          type: array
          title: Files
          description: Repository-relative paths written by the export.
      type: object
      required:
        - commit
        - files
      title: WorkspaceSyncExportResult
      description: 'Outcome of a workspace export: the commit made and files written.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResourceRef:
      properties:
        resource_type:
          $ref: '#/components/schemas/SyncResourceType'
          description: Type of the referenced resource.
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Id
          description: Git source id of the resource, if referenced by source id.
        local_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Local Id
          description: Local database id of the resource, if referenced by local id.
      type: object
      required:
        - resource_type
      title: ResourceRef
      description: Reference to a single resource by type and either source or local id.
    CommitInfo:
      properties:
        status:
          $ref: '#/components/schemas/PushStatus'
        sha:
          anyOf:
            - type: string
            - type: 'null'
          title: Sha
        ref:
          type: string
          title: Ref
        base_ref:
          type: string
          title: Base Ref
        pr_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Pr Url
        pr_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Pr Number
        pr_reused:
          type: boolean
          title: Pr Reused
          default: false
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
        - status
        - sha
        - ref
        - base_ref
      title: CommitInfo
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SyncResourceType:
      type: string
      enum:
        - workflow
        - agent_preset
        - skill
        - table
        - case_tag
        - case_field
        - case_dropdown
        - case_duration
        - variable
        - secret_metadata
      title: SyncResourceType
      description: Kind of workspace resource that can be synced to and from Git.
    PushStatus:
      type: string
      enum:
        - committed
        - no_op
      title: PushStatus
      description: Status of a push/commit operation.
  securitySchemes:
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: fastapiusersauth
    ServiceAccountApiKeyBearer:
      type: http
      description: Tracecat service account API key.
      scheme: bearer

````