{
  "openapi": "3.1.0",
  "info": {
    "title": "Replic Shopify integration -- TO BE DEVELOPED",
    "description": "API reference for the Replic Shopify integration. Use the Replic app in Shopify admin to manage products, orders, and download settings. This spec documents the API surface for developers integrating with Replic.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.replic.ca",
      "description": "Replic API"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/orders": {
      "get": {
        "summary": "List orders",
        "description": "Returns orders that the authenticated store has access to. Use the [Replic Shopify orders list](https://admin.shopify.com/apps/replic/app/orders) in the app to view and service orders, resend download emails, and revoke product access.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of results to return",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Order"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{orderId}": {
      "get": {
        "summary": "Get order details",
        "description": "Returns details for a single order, including files, email status, and download attempts. See [Servicing orders](/shopify-integration/orders/servicing-orders) for how to resend download emails and revoke product access in the app.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "description": "ID of the order",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "404": {
            "description": "Order not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "/webhooks/shopify/orders": {
      "post": {
        "summary": "Shopify order webhook",
        "description": "Receives Shopify order events (e.g. orders/paid). Used by the Replic Shopify integration to process new orders and trigger fulfillment.",
        "requestBody": {
          "description": "Shopify webhook payload",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Shopify order webhook payload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook received successfully"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Order identifier",
            "type": "string"
          },
          "status": {
            "description": "Order status",
            "type": "string"
          },
          "createdAt": {
            "description": "When the order was created",
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "required": [
          "error",
          "message"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}