{
  "openapi": "3.1.1",
  "info": {
    "title": "Tax GraphQL API",
    "version": "2.0.0"
  },
  "servers": [
    {
      "url": "https://api.godaddy.com/v2/commerce",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Tax",
      "description": "Execute GraphQL operations against the commerce tax subgraph for a store."
    }
  ],
  "paths": {
    "/stores/{storeId}/tax-subgraph": {
      "post": {
        "operationId": "postTaxGraphql",
        "tags": [
          "Tax"
        ],
        "summary": "Tax GraphQL endpoint",
        "description": "Proxies GraphQL to the tax subgraph. Use the `query` field for the GraphQL document and optional `variables` / `operationName`. Send the same store ID in the `{storeId}` path and the `x-store-id` header. The header is required. If they differ, the subgraph uses the header. A missing header returns HTTP 200 with GraphQL `AUTHENTICATION_ERROR` (`Failed to authorize`).",
        "x-godaddy-graphql-schema": "./graphql/schema.graphql",
        "x-codeSamples": [
          {
            "lang": "graphql",
            "label": "GraphQL",
            "source": "query GetClassification($id: ID!) {\n  classification(id: $id) {\n    id\n  }\n}"
          },
          {
            "id": "direct-api-access",
            "lang": "js",
            "label": "Direct API Access",
            "source": "const response = await fetch(\n  'https://api.godaddy.com/v2/commerce/stores/{storeId}/tax-subgraph',\n  {\n    method: 'POST',\n    headers: {\n      Authorization: 'Bearer $ACCESS_TOKEN',\n      'Content-Type': 'application/json',\n      'x-store-id': '{storeId}',\n    },\n    body: JSON.stringify({\n      query: `\n        query GetClassification($id: ID!) {\n          classification(id: $id) {\n            id\n          }\n        }\n      `,\n      variables: { id: 'CLASSIFICATION_ID' },\n    }),\n  },\n);\n\nconst { data } = await response.json();\nconsole.log(data);"
          }
        ],
        "security": [
          {
            "PAT": [
              "commerce.tax:read"
            ]
          },
          {
            "PAT": [
              "commerce.tax:create"
            ]
          },
          {
            "PAT": [
              "commerce.tax:write"
            ]
          },
          {
            "PAT": [
              "commerce.tax:delete"
            ]
          }
        ],
        "parameters": [
          {
            "name": "storeId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/x-ext/a855712"
            }
          },
          {
            "name": "x-store-id",
            "in": "header",
            "required": true,
            "description": "Required store ID. Send the same value as `{storeId}` in the path. If they differ, the subgraph uses this header.",
            "schema": {
              "$ref": "#/x-ext/a855712"
            }
          }
        ],
        "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 GetClassification($id: ID!) { classification(id: $id) { id } }",
                    "variables": {
                      "id": "CLASSIFICATION_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"
          },
          "404": {
            "description": "Store not found"
          },
          "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.tax:read`, `commerce.tax:create`, `commerce.tax:write`, `commerce.tax:delete`."
      }
    }
  },
  "x-ext-urls": {
    "a855712": "https://schemas.api.godaddy.com/common-types/v1/schemas/yaml/uuid.yaml"
  },
  "x-ext": {
    "a855712": {
      "$id": "https://godaddy.com/schemas/common/uuid.v1",
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "description": "A universally unique identifier (UUID) in [RFC-4122 format](https://tools.ietf.org/html/rfc4122).",
      "type": "string",
      "format": "uuid"
    }
  }
}
