{
  "components": {
    "headers": {
      "X-Quota-Limit": {
        "schema": {
          "type": "integer"
        }
      },
      "X-Quota-Remaining": {
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Limit": {
        "description": "req/min",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "s",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Invalid parameters."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Account suspended, no plan for this API, or IP not allowed."
      },
      "NotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Resource not found."
      },
      "RateLimited": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Per-minute limit or monthly quota reached. See Retry-After."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Missing, invalid, expired or wrong-product key."
      },
      "Unavailable": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "API under maintenance or overloaded."
      }
    },
    "schemas": {
      "Error": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "examples": [
                  "rate_limited"
                ],
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKeyHeader": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      },
      "bearerAuth": {
        "bearerFormat": "flye_sk_... | flye_test_...",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "externalDocs": {
    "url": "https://flye.win/docs"
  },
  "info": {
    "contact": {
      "name": "flye.win",
      "url": "https://flye.win/docs"
    },
    "description": "Backend utilities every project ends up rewriting. Small, stateless responses, deterministic where it makes sense. A good way to validate your flye.win integration before using other APIs.",
    "termsOfService": "https://flye.win/terms",
    "title": "flye.win Utils API",
    "version": "1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/utils/base64": {
      "post": {
        "description": "Converts text to and from standard base64 (RFC 4648).",
        "operationId": "utilsBase64",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "mode": "encode",
                "text": "hello, world"
              },
              "schema": {
                "properties": {
                  "mode": {
                    "description": "encode or decode. Defaults to encode.",
                    "type": "string"
                  },
                  "text": {
                    "description": "Content to convert.",
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "mode": "encode",
                  "result": "aGVsbG8sIHdvcmxk"
                }
              }
            },
            "description": "OK",
            "headers": {
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "summary": "Encode / decode base64",
        "tags": [
          "utils"
        ]
      }
    },
    "/utils/hash": {
      "get": {
        "description": "Hashes the given text and returns it as hex.",
        "operationId": "utilsHash",
        "parameters": [
          {
            "description": "Input text (up to 64 KB).",
            "example": "flye",
            "in": "query",
            "name": "text",
            "required": true,
            "schema": {
              "examples": [
                "flye"
              ],
              "type": "string"
            }
          },
          {
            "description": "md5, sha1, sha256 or sha512. Defaults to sha256.",
            "example": "sha256",
            "in": "query",
            "name": "algo",
            "required": false,
            "schema": {
              "examples": [
                "sha256"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "algo": "sha256",
                  "hex": "9a5c3b4f1f8e0d6c…"
                }
              }
            },
            "description": "OK",
            "headers": {
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "summary": "Compute a hash",
        "tags": [
          "utils"
        ]
      }
    },
    "/utils/ip": {
      "get": {
        "description": "Returns the IP and user agent your request reached the platform with.",
        "operationId": "utilsIp",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "ip": "203.0.113.24",
                  "user_agent": "curl/8.7.1"
                }
              }
            },
            "description": "OK",
            "headers": {
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "summary": "Source IP",
        "tags": [
          "utils"
        ]
      }
    },
    "/utils/uuid": {
      "get": {
        "description": "Generates 1 to 100 UUIDs. Version 7 sorts by time, which suits primary keys.",
        "operationId": "utilsUuid",
        "parameters": [
          {
            "description": "How many, from 1 to 100. Defaults to 1.",
            "example": "2",
            "in": "query",
            "name": "count",
            "required": false,
            "schema": {
              "examples": [
                "2"
              ],
              "type": "integer"
            }
          },
          {
            "description": "4 (random) or 7 (time-ordered). Defaults to 4.",
            "example": "7",
            "in": "query",
            "name": "version",
            "required": false,
            "schema": {
              "examples": [
                "7"
              ],
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "uuids": [
                    "019a3c1e-7b2d-7c41-9f0e-5d8a21c4b6e3",
                    "019a3c1e-7b2d-7f88-a1c2-0e93b7d45f12"
                  ],
                  "version": 7
                }
              }
            },
            "description": "OK",
            "headers": {
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "summary": "Generate UUIDs",
        "tags": [
          "utils"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "servers": [
    {
      "url": "https://flye.win/v1"
    }
  ],
  "tags": [
    {
      "description": "Utils — UUIDs, hashes, base64 and IP inspection in one call.",
      "externalDocs": {
        "url": "https://flye.win/apis/utils"
      },
      "name": "utils"
    }
  ]
}