{
  "openapi": "3.1.1",
  "info": {
    "title": "Order GraphQL API",
    "version": "1.0.0",
    "description": "Commerce order **GraphQL subgraph**. Send standard GraphQL POST requests (query, variables, operationName) to this HTTP endpoint. Personal Access Tokens must include the `commerce.order:*` scope that matches the GraphQL operation (read, create, update, cancel, complete, or archive)."
  },
  "servers": [
    {
      "url": "https://api.godaddy.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Order subgraph",
      "description": "Execute GraphQL operations against the commerce order subgraph. The GraphQL schema is referenced from this repository for tooling and review (`x-godaddy-graphql-schema`)."
    }
  ],
  "paths": {
    "/v1/commerce/order-subgraph": {
      "post": {
        "operationId": "postOrderGraphql",
        "summary": "Order GraphQL endpoint",
        "description": "Proxies GraphQL to the order subgraph. Use the `query` field for the GraphQL document and optional `variables` / `operationName`.",
        "tags": [
          "Order subgraph"
        ],
        "parameters": [
          {
            "name": "x-store-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the store the operation targets — send it on every request. Required for all order queries and mutations; omitting it returns HTTP 200 with a GraphQL error whose `extensions.code` is `UNAUTHENTICATED`. (Schema-level metadata requests such as `__typename` and introspection are the only operations that resolve without it.)"
          }
        ],
        "x-godaddy-graphql-schema": "./graphql/schema.graphql",
        "x-codeSamples": [
          {
            "lang": "graphql",
            "label": "GraphQL",
            "source": "query GetOrder($id: ID!) {\n  orderById(id: $id) {\n    id\n    number\n    statuses {\n      status\n    }\n  }\n}"
          },
          {
            "id": "direct-api-access",
            "lang": "js",
            "label": "Direct API Access",
            "source": "const response = await fetch(\n  'https://api.godaddy.com/v1/commerce/order-subgraph',\n  {\n    method: 'POST',\n    headers: {\n      Authorization: 'Bearer $ACCESS_TOKEN',\n      'Content-Type': 'application/json',\n      'x-store-id': '$STORE_ID',\n    },\n    body: JSON.stringify({\n      query: `\n        query GetOrder($id: ID!) {\n          orderById(id: $id) {\n            id\n            number\n            statuses {\n              status\n            }\n          }\n        }\n      `,\n      variables: { id: 'ORDER_ID' },\n    }),\n  },\n);\n\nconst { data } = await response.json();\nconsole.log(data);"
          }
        ],
        "security": [
          {
            "PAT": [
              "commerce.order:read"
            ]
          },
          {
            "PAT": [
              "commerce.order:create"
            ]
          },
          {
            "PAT": [
              "commerce.order:update"
            ]
          },
          {
            "PAT": [
              "commerce.order:cancel"
            ]
          },
          {
            "PAT": [
              "commerce.order:complete"
            ]
          },
          {
            "PAT": [
              "commerce.order:archive"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string"
                  },
                  "variables": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "operationName": {
                    "type": "string"
                  }
                }
              },
              "examples": {
                "default": {
                  "value": {
                    "query": "query GetOrder($id: ID!) { orderById(id: $id) { id number statuses { status } } }",
                    "variables": {
                      "id": "ORDER_ID"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "GraphQL response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PAT": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal Access Token (PAT). Include as `Authorization: Bearer $GODADDY_PAT`. Required scopes: `commerce.order:read`, `commerce.order:create`, `commerce.order:update`, `commerce.order:cancel`, `commerce.order:complete`, `commerce.order:archive`."
      }
    }
  },
  "x-ext-urls": {}
}
