{
  "openapi": "3.0.2",
  "info": {
    "title": "SCX Authentication API",
    "version": "1.0",
    "x-logo": {
      "url": "https://scx-sandbox.ui.jtl-software.com/docs/scx.png"
    },
    "description": "SCX Authentication API\n"
  },
  "servers": [
    {
      "url": "https://scx-sbx.api.jtl-software.com",
      "description": "Sandbox Environment"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Authentication and access token management"
    }
  ],
  "paths": {
    "/v1/auth": {
      "post": {
        "operationId": "Authenticate",
        "tags": [
          "Authentication"
        ],
        "summary": "Session Token\n",
        "description": "Create Session Token\n",
        "requestBody": {
          "description": "Refresh token used to obtain a new short-lived session (access) token.",
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "refreshToken": {
                    "type": "string",
                    "example": "SELLER:0eyJhY2NvdW50SWQiOiIxNDU3IiwiaWF0IjoxNTE2MjM5MDIyfQ"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/AuthToken"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "426": {
            "$ref": "#/components/responses/RequestThrottled"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/auth/create/seller-token": {
      "post": {
        "operationId": "CreateSellerToken",
        "tags": [
          "Authentication"
        ],
        "summary": "Create Access Token for Seller access.\n",
        "description": "Create a new Access Token based on secret PIN.\n",
        "parameters": [
          {
            "in": "query",
            "name": "pin",
            "description": "One-time PIN code issued to the seller during channel linking",
            "schema": {
              "type": "string"
            },
            "example": "433273"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SellerAccessToken"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AccessForbidden"
          },
          "404": {
            "$ref": "#/components/responses/ResourceNotFound"
          },
          "426": {
            "$ref": "#/components/responses/RequestThrottled"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "SellerAccessToken": {
        "description": "Ok",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "token": {
                  "type": "string",
                  "example": "SELLER.sfhgduwgfwre436fgsudfgwu4zgdsiflsdagvsaifga48ogc"
                }
              }
            }
          }
        },
        "headers": {
          "X-RateLimit-Limit": {
            "schema": {
              "type": "integer"
            },
            "description": "Request limit per hour."
          },
          "X-RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            },
            "description": "The number of requests left for the time window."
          },
          "X-RateLimit-Reset": {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "The UTC date/time at which the current rate limit window resets."
          }
        }
      },
      "AuthToken": {
        "description": "Create new Auth Token\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuthToken"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponseList"
            },
            "example": {
              "errorList": [
                {
                  "code": "VAL100",
                  "message": "Required field sellerId not found",
                  "severity": "error",
                  "hint": "Check the field `sellerId` — it must be a non-empty string."
                }
              ]
            }
          }
        }
      },
      "RequestThrottled": {
        "description": "User has send to many requests"
      },
      "ServerError": {
        "description": "Unexpected Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponseList"
            },
            "example": {
              "errorList": [
                {
                  "code": "GEN500",
                  "message": "Internal Server Error",
                  "severity": "error",
                  "hint": null
                }
              ]
            }
          }
        }
      },
      "AccessForbidden": {
        "description": "Access forbidden, invalid or unknown Token was used."
      },
      "ResourceNotFound": {
        "description": "Requested resource not found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponseList"
            },
            "example": {
              "errorList": [
                {
                  "code": "GEN404",
                  "message": "Not found",
                  "severity": "error",
                  "hint": null
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "AuthToken": {
        "description": "Issued session credentials returned by the auth endpoint. Contains the bearer token,\nits scope (seller, channel, or admin), and absolute/relative expiry timestamps.\n",
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "SELLER",
              "CHAN",
              "ADM"
            ],
            "example": "SELLER"
          },
          "authToken": {
            "type": "string",
            "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOiIxNDU3IiwiaWF0IjoxNTE2MjM5MDIyfQ.uWKi0yGrf35hapLiNAb1QHpQ5dLJ7hyUg8_R6GU6RzU"
          },
          "tokenExpireAt": {
            "type": "string",
            "format": "date-time",
            "example": "2036-04-01T12:00:00+00:00"
          },
          "expiresIn": {
            "type": "integer",
            "example": 360
          }
        }
      },
      "ErrorResponseList": {
        "type": "object",
        "properties": {
          "errorList": {
            "nullable": true,
            "type": "array",
            "example": [
              {
                "code": "GEN700",
                "message": "Seller SELLER_4711 does not exist on channel kaufland.",
                "severity": "error",
                "hint": "i9n-order22"
              }
            ],
            "items": {
              "title": "Error",
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "example": "GEN700"
                },
                "message": {
                  "type": "string",
                  "example": "Seller SELLER_4711 does not exist on channel kaufland."
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning",
                    "info"
                  ],
                  "default": "error"
                },
                "hint": {
                  "type": "string",
                  "nullable": true,
                  "example": "i9n-order22"
                }
              }
            }
          }
        }
      }
    }
  }
}