{
  "openapi": "3.1.0",
  "info": {
    "title": "Kash.click shop creation — legacy integration contract",
    "version": "1.0.0",
    "description": "Retained for existing integrations. New integrations should use /workers/createShop.php in openapi.json. No removal date is scheduled. New credentials are managed keys with all permissions and no expiration; old keys remain accepted."
  },
  "servers": [
    {
      "url": "https://kash.click"
    }
  ],
  "components": {
    "schemas": {
      "StandardFailureResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "result": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "result"
        ],
        "additionalProperties": true
      },
      "CredentialsSuccessResponse": {
        "type": "object",
        "description": "API credentials only. Browser session cookies are never included in this response.",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "result": {
            "type": "string"
          },
          "APIKEY": {
            "type": "string",
            "pattern": "^kash_[a-f0-9]{64}$",
            "description": "New managed key, all current permissions, no expiration. Store and reuse it for business calls; authenticate again only to issue another key."
          },
          "SHOPID": {
            "$ref": "#/components/schemas/ShopID"
          }
        },
        "required": [
          "success",
          "result",
          "APIKEY",
          "SHOPID"
        ],
        "additionalProperties": true
      },
      "ShopID": {
        "type": "string",
        "minLength": 1
      },
      "APIKEY": {
        "type": "string",
        "pattern": "^(?:[a-f0-9]{32}|[a-f0-9]{40}|kash_[a-f0-9]{64})$",
        "description": "Use a generated managed API key. Existing historical 32/40-character keys remain valid. Every successful password/OTP credential exchange creates a distinct managed key with all 13 current permissions and no expiration, visible and revocable in Configuration > Webservices > Clés API. Creation-session retries recover the same key and do not restore a revoked, deleted or expired key. Manually created keys use the administrator-selected permissions and expiration. Keys are shop-scoped; write permissions include read. Secrets must not be logged."
      },
      "Email": {
        "type": "string",
        "format": "email"
      }
    }
  },
  "paths": {
    "/workers/addShop.php": {
      "post": {
        "operationId": "createShopAccountLegacy",
        "summary": "Create a new shop account",
        "description": "Stable integration API: creates a Kash.click shop account and immediately returns SHOPID and APIKEY. Existing URL, parameters and responses are preserved independently of interactive identity onboarding. This API does not verify the contact email or automatically attach the shop to an identity. Interactive creation uses the email-confirmed identity flow. Newly issued APIKEY values are managed kash_ keys with all permissions and no expiration. Existing historical keys remain valid. Requires the shop_api_keys migration and encryption configuration. Prefer createShop.php for new integrations. A 503 after creation may leave the shop created: recover access before starting another creation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "$ref": "#/components/schemas/Email"
                  },
                  "data[companyRegistrationNum]": {
                    "type": "string"
                  },
                  "data[taxRegistrationNum]": {
                    "type": "string"
                  },
                  "data[adressline1]": {
                    "type": "string"
                  },
                  "data[postCode]": {
                    "type": "string"
                  },
                  "data[city]": {
                    "type": "string"
                  },
                  "data[country]": {
                    "type": "string"
                  },
                  "data[phone]": {
                    "type": "string"
                  },
                  "data[urlwebsite]": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "default": {
                  "value": {
                    "email": "owner@example.com",
                    "data[companyRegistrationNum]": "123456789",
                    "data[taxRegistrationNum]": "FR00123456789",
                    "data[adressline1]": "10 rue de Paris",
                    "data[postCode]": "75001",
                    "data[city]": "Paris",
                    "data[country]": "FR",
                    "data[phone]": "+33123456789",
                    "data[urlwebsite]": "https://example.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account creation result",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CredentialsSuccessResponse"
                    },
                    {
                      "$ref": "#/components/schemas/StandardFailureResponse"
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Managed-key storage or another required service is unavailable; no historical fallback.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "deprecated": true
      }
    }
  }
}
