{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Commerce Cloud GraphQL API",
    "version": "1.0.0",
    "description": "OpenAPI transport descriptor for the AI Commerce Cloud GraphQL endpoint. The operation schema is GraphQL SDL at https://docs.aicommerce.cloud/schema.graphql and introspection JSON at https://docs.aicommerce.cloud/graphql.schema.json.",
    "contact": {
      "name": "AI Commerce Cloud onboarding",
      "email": "info@petrosoft.fi"
    }
  },
  "externalDocs": {
    "description": "Human-readable GraphQL API reference",
    "url": "https://docs.aicommerce.cloud/"
  },
  "servers": [
    {
      "url": "https://api.aicommerce.fi",
      "description": "Production"
    }
  ],
  "paths": {
    "/graphql": {
      "post": {
        "operationId": "executeGraphQL",
        "summary": "Execute a GraphQL operation",
        "description": "Executes a tenant-authenticated GraphQL query or mutation against AI Commerce Cloud.",
        "externalDocs": {
          "description": "GraphQL schema",
          "url": "https://docs.aicommerce.cloud/schema.graphql"
        },
        "parameters": [
          {
            "name": "X-GraphQL-Secret",
            "in": "header",
            "required": true,
            "description": "AI Commerce Cloud API access token issued during onboarding.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "description": "Tenant identifier issued during onboarding.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Tenant-Secret",
            "in": "header",
            "required": true,
            "description": "Tenant-specific secret issued during onboarding.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GraphQLRequest"
              },
              "example": {
                "query": "query Products($limit: Int, $offset: Int) { products(limit: $limit, offset: $offset) { id name price } }",
                "variables": {
                  "limit": 5,
                  "offset": 0
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "GraphQL response. Check `errors[]` even when HTTP status is 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphQLResponse"
                }
              }
            }
          },
          "403": {
            "description": "Missing or invalid edge/API headers."
          },
          "429": {
            "description": "Tenant rate limit exceeded."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GraphQLRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "description": "GraphQL query or mutation document."
          },
          "variables": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional GraphQL variables object."
          },
          "operationName": {
            "type": "string",
            "description": "Optional operation name when the document contains multiple operations."
          }
        }
      },
      "GraphQLResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "data": {
            "description": "GraphQL operation result. May be null when errors occur."
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphQLError"
            }
          }
        }
      },
      "GraphQLError": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}
