# Export Data in OpenAPI/Swagger Format

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/projects/{projectId}/export-openapi:
    post:
      summary: Export Data in OpenAPI/Swagger Format
      deprecated: false
      description: ''
      tags:
        - Import & Export
      parameters:
        - name: projectId
          in: path
          description: ''
          required: true
          example: '{{projectId}}'
          schema:
            type: string
        - name: locale
          in: query
          description: ''
          required: false
          example: en-US
          schema:
            type: string
        - name: X-Apidog-Api-Version
          in: header
          description: OpenAPI versions, required, otherwise an error will occur.
          required: true
          example: '2024-03-28'
          schema:
            type: string
            enum:
              - '2024-03-28'
            x-apidog:
              enumDescriptions:
                '2024-03-28': ''
        - name: Authorization
          in: header
          description: >-
            Authorization is in the format of Bearer Personal Access Token.
            Refer to How to Generate Apidog OpenAPI Access Token for more
            information.
          required: true
          example: Bearer {{access_token}}
          schema:
            type: string
            default: Bearer {{access_token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                scope:
                  oneOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          const: ALL
                        excludedByTags:
                          type: array
                          items:
                            type: string
                          description: Exclude content that includes specified tags
                      title: ALL
                      description: Export all endpotints
                      x-apidog-orders:
                        - type
                        - excludedByTags
                      required:
                        - type
                    - type: object
                      properties:
                        type:
                          type: string
                          const: SELECTED_ENDPOINTS
                        selectedEndpointIds:
                          type: array
                          items:
                            type: number
                          description: Specify the IDs of selected endpoints to export
                        excludedByTags:
                          type: array
                          items:
                            type: string
                          description: Exclude content that includes specified tags
                      title: SELECTED_ENDPOINTS
                      description: Export selected endpoints
                      x-apidog-orders:
                        - type
                        - selectedEndpointIds
                        - excludedByTags
                      required:
                        - type
                        - selectedEndpointIds
                    - type: object
                      properties:
                        type:
                          type: string
                          title: ''
                          const: SELECTED_TAGS
                        selectedTags:
                          type: array
                          items:
                            type: string
                          description: Specify the tags to include in the export range.
                        excludedByTags:
                          type: array
                          items:
                            type: string
                          description: Exclude content that includes specified tags
                      title: SELECTED_TAGS
                      description: Export endpoints with specified tags
                      x-apidog-orders:
                        - type
                        - selectedTags
                        - excludedByTags
                      required:
                        - type
                        - selectedTags
                    - type: object
                      properties:
                        type:
                          type: string
                          const: SELECTED_FOLDERS
                        selectedFolderIds:
                          type: array
                          items:
                            type: number
                          description: Specify the IDs of selected folders to export
                        excludedByTags:
                          type: array
                          items:
                            type: string
                          description: Exclude content that includes specified tags
                      x-apidog-orders:
                        - type
                        - selectedFolderIds
                        - excludedByTags
                      description: Export selected folders
                      required:
                        - type
                        - selectedFolderIds
                      title: SELECTED_FOLDERS
                options:
                  type: object
                  properties:
                    addFoldersToTags:
                      type: boolean
                      description: >-
                        Specify whether to include the Endpoint folder name in
                        the tag field.
                      default: false
                    includeApidogExtensionProperties:
                      type: boolean
                      description: >-
                        Specifies whether to include the OpenAPI specification
                        extension field `x-apidog` of Apidog.
                      default: false
                  x-apidog-orders:
                    - includeApidogExtensionProperties
                    - addFoldersToTags
                oasVersion:
                  type: string
                  description: >-
                    Specify the version of the OpenAPI specification to export.
                    Allowed values are "2.0", "3.0", or "3.1".
                  enum:
                    - '3.0'
                    - '3.1'
                    - '2.0'
                  default: '3.1'
                  x-apidog-enum:
                    - name: ''
                      value: '3.0'
                      description: OpenAPI 3.0
                    - name: ''
                      value: '3.1'
                      description: OpenAPI 3.1
                    - name: ''
                      value: '2.0'
                      description: Swagger 2.0
                exportFormat:
                  type: string
                  description: >-
                    Specifies the format of the exported OpenAPI file. It can
                    have values such as "JSON" or "YAML".
                  enum:
                    - JSON
                    - YAML
                  default: JSON
                  x-apidog-enum:
                    - name: ''
                      value: JSON
                      description: ''
                    - name: ''
                      value: YAML
                      description: ''
                environmentIds:
                  type: array
                  items:
                    type: number
                  description: Specify the ID of the environment needed to be exported.
                x-apidog-orders:
                  type: string
                x-apidog-ignore-properties:
                  type: string
                branchId:
                  type: number
                  description: >-
                    Specify the ID of the branch to export. Defaults to the
                    `main` branch ID if unspecified.
                moduleId:
                  type: number
                  description: >-
                    Specify the ID of the module to export. Defaults to the
                    `default` module ID if unspecified.
              x-apidog-orders:
                - scope
                - options
                - oasVersion
                - exportFormat
                - environmentIds
                - x-apidog-orders
                - x-apidog-ignore-properties
                - branchId
                - moduleId
              examples:
                - scope:
                    type: ALL
                    selectedEndpointIds:
                      - 0
                    selectedTags:
                      - string
                    excludedByTags:
                      - string
                  options:
                    includeApidogExtensionProperties: false
                    addFoldersToTags: false
                  oasVersion: '3.1'
                  exportFormat: JSON
                  environmentIds:
                    - 0
            example:
              scope:
                type: ALL
                excludedByTags:
                  - pet
              options:
                includeApidogExtensionProperties: false
                addFoldersToTags: false
              oasVersion: '3.1'
              exportFormat: JSON
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  openapi:
                    type: string
                  info:
                    type: object
                    properties: {}
                    x-apidog-orders: []
                  tags:
                    type: array
                    items:
                      type: object
                      properties: {}
                      x-apidog-orders: []
                  paths:
                    type: object
                    properties: {}
                    x-apidog-orders: []
                  components:
                    type: object
                    properties: {}
                    x-apidog-orders: []
                  servers:
                    type: array
                    items:
                      type: string
                x-apidog-orders:
                  - openapi
                  - info
                  - tags
                  - paths
                  - components
                  - servers
                required:
                  - openapi
                  - components
                  - paths
                  - tags
                  - info
                  - servers
              example:
                openapi: 3.0.1
                info:
                  title: Example
                  description: ''
                  version: 1.0.0
                tags:
                  - name: Example Project
                  - name: Pet
                paths:
                  /pet/{petId}:
                    get:
                      summary: Query pet details
                      deprecated: false
                      description: ''
                      tags:
                        - Example Project
                        - Pet
                      parameters:
                        - name: petId
                          in: path
                          description: Pet ID
                          required: true
                          example: '1'
                          schema:
                            type: string
                      responses:
                        '200':
                          description: Success
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                    minimum: 0
                                    maximum: 0
                                    description: Status code
                                  data:
                                    $ref: '#/components/schemas/Pet'
                                    description: Pet information
                                required:
                                  - code
                                  - data
                              examples:
                                '1':
                                  summary: Success example
                                  value:
                                    code: 0
                                    data:
                                      name: Hello Kity
                                      photoUrls:
                                        - http://dummyimage.com/400x400
                                      id: 3
                                      category:
                                        id: 71
                                        name: Cat
                                      tags:
                                        - id: 22
                                          name: Cat
                                      status: sold
                        '400':
                          description: Invalid parameters
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                  message:
                                    type: string
                                required:
                                  - code
                                  - message
                        '404':
                          description: Record not found
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                  message:
                                    type: string
                                required:
                                  - code
                                  - message
                      security: []
                    delete:
                      summary: Delete pet information
                      deprecated: false
                      description: ''
                      tags:
                        - Example Project
                        - Pet
                      parameters:
                        - name: petId
                          in: path
                          description: Pet id to delete
                          required: true
                          schema:
                            type: string
                        - name: api_key
                          in: header
                          description: ''
                          schema:
                            type: string
                      responses:
                        '200':
                          description: Success
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                    minimum: 0
                                    maximum: 0
                                required:
                                  - code
                              examples:
                                '1':
                                  summary: Success example
                                  value:
                                    code: 0
                      security: []
                  /pet:
                    post:
                      summary: Create pet information
                      deprecated: false
                      description: ''
                      tags:
                        - Example Project
                        - Pet
                      parameters: []
                      requestBody:
                        content:
                          application/x-www-form-urlencoded:
                            schema:
                              type: object
                              properties:
                                name:
                                  description: Pet name
                                  example: Hello Kitty
                                  type: string
                                status:
                                  description: Pet sale status
                                  example: sold
                                  type: string
                              required:
                                - name
                                - status
                      responses:
                        '201':
                          description: Success
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                    minimum: 0
                                    maximum: 0
                                  data:
                                    $ref: '#/components/schemas/Pet'
                                    description: Pet information
                                required:
                                  - code
                                  - data
                              examples:
                                '1':
                                  summary: Success example
                                  value:
                                    code: 0
                                    data:
                                      name: Hello Kity
                                      photoUrls:
                                        - http://dummyimage.com/400x400
                                      id: 3
                                      category:
                                        id: 71
                                        name: Cat
                                      tags:
                                        - id: 22
                                          name: Cat
                                      status: sold
                      security: []
                    put:
                      summary: Update pet information
                      deprecated: false
                      description: ''
                      tags:
                        - Example Project
                        - Pet
                      parameters: []
                      requestBody:
                        content:
                          application/json:
                            schema:
                              type: object
                              properties: {}
                      responses:
                        '200':
                          description: Success
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                  data:
                                    $ref: '#/components/schemas/Pet'
                                    description: Pet information
                                required:
                                  - code
                                  - data
                              examples:
                                '1':
                                  summary: Success example
                                  value:
                                    code: 0
                                    data:
                                      name: Hello Kity
                                      photoUrls:
                                        - http://dummyimage.com/400x400
                                      id: 3
                                      category:
                                        id: 71
                                        name: Cat
                                      tags:
                                        - id: 22
                                          name: Cat
                                      status: sold
                        '404':
                          description: Record not found
                          content:
                            application/json:
                              schema:
                                type: object
                                properties: {}
                        '405':
                          description: Validation error
                          content:
                            application/json:
                              schema:
                                type: object
                                properties: {}
                      security: []
                  /pet/findByStatus:
                    get:
                      summary: Find pet by status
                      deprecated: false
                      description: ''
                      tags:
                        - Example Project
                        - Pet
                      parameters:
                        - name: status
                          in: query
                          description: Status values that need to be considered for filter
                          required: true
                          schema:
                            type: string
                      responses:
                        '200':
                          description: Success
                          content:
                            application/json:
                              schema:
                                type: array
                                items:
                                  $ref: '#/components/schemas/Pet'
                                  description: Pet information
                              examples:
                                '1':
                                  summary: Success example
                                  value:
                                    code: 0
                                    data:
                                      - name: Hello Kity
                                        photoUrls:
                                          - http://dummyimage.com/400x400
                                        id: 3
                                        category:
                                          id: 71
                                          name: Cat
                                        tags:
                                          - id: 22
                                            name: Cat
                                        status: sold
                                      - name: White Dog
                                        photoUrls:
                                          - http://dummyimage.com/400x400
                                        id: 3
                                        category:
                                          id: 71
                                          name: Dog
                                        tags:
                                          - id: 22
                                            name: Dog
                                        status: sold
                        '400':
                          description: Invalid status value
                          content:
                            application/json:
                              schema:
                                type: object
                                properties:
                                  code:
                                    type: integer
                                required:
                                  - code
                      security: []
                components:
                  schemas:
                    Tag:
                      type: object
                      properties:
                        id:
                          type: integer
                          format: int64
                          minimum: 1
                          description: Tag ID
                        name:
                          type: string
                          description: Tag name
                      xml:
                        name: Tag
                    Category:
                      type: object
                      properties:
                        id:
                          type: integer
                          format: int64
                          minimum: 1
                          description: Category ID
                        name:
                          type: string
                          description: Category name
                      xml:
                        name: Category
                    Pet:
                      required:
                        - name
                        - photoUrls
                        - id
                        - category
                        - tags
                        - status
                      type: object
                      properties:
                        id:
                          type: integer
                          format: int64
                          minimum: 1
                          description: Pet ID
                        category:
                          $ref: '#/components/schemas/Category'
                          description: Category
                        name:
                          type: string
                          description: Name
                          examples:
                            - doggie
                        photoUrls:
                          type: array
                          items:
                            type: string
                          description: Photo URLs
                        tags:
                          type: array
                          items:
                            $ref: '#/components/schemas/Tag'
                          description: Tags
                        status:
                          type: string
                          description: Pet sale status
                          enum:
                            - available
                            - pending
                            - sold
                  securitySchemes: {}
                servers: []
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: Import & Export
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/538323/apis/api-7312737-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.apidog.com
    description: Prod Env
security: []

```
