{
  "openapi": "3.1.0",
  "info": {
    "title": "Dosyne public reference API",
    "version": "1.0.0",
    "summary": "Insulin syringe reference and reconstitution arithmetic, as JSON.",
    "description": "A read-only, keyless, CORS-open API over what dosyne.com publishes: what a mark on a syringe barrel is worth on each calibration, the arithmetic that turns a vial and a diluent volume into a syringe reading, and an index of the reference corpus. The same values the human-readable pages render. Reuse is CC BY 4.0 with a link back.\n\nIt contains no dosing information and never will: there is no endpoint here that returns an amount anyone should take, and `boundary` in every payload says so in machine-readable form.",
    "contact": {
      "name": "Dosyne support",
      "email": "support@dosyne.com",
      "url": "https://dosyne.com/contact/"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "termsOfService": "https://dosyne.com/terms/"
  },
  "servers": [
    {
      "url": "https://dosyne.com/api/v1",
      "description": "Static origin behind Cloudflare"
    }
  ],
  "paths": {
    "/syringes.json": {
      "get": {
        "operationId": "getSyringes",
        "summary": "Syringe calibrations, barrel capacities and diluents",
        "description": "Each calibration with its units-per-millilitre factor. Use `ml_per_unit` to turn a reading into a volume; never assume 0.01 mL without checking the scale printed on the barrel.",
        "responses": {
          "200": {
            "description": "The syringe reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyringeReference"
                }
              }
            }
          }
        }
      }
    },
    "/formulas.json": {
      "get": {
        "operationId": "getFormulas",
        "summary": "The reconstitution arithmetic and its readability thresholds",
        "responses": {
          "200": {
            "description": "The formula set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormulaSet"
                }
              }
            }
          }
        }
      }
    },
    "/library.json": {
      "get": {
        "operationId": "getLibrary",
        "summary": "Index of every page, with its markdown twin",
        "responses": {
          "200": {
            "description": "The corpus index",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/apps.json": {
      "get": {
        "operationId": "getApps",
        "summary": "Dated App Store snapshot of peptide and GLP-1 tracking apps",
        "responses": {
          "200": {
            "description": "The app snapshot",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/status.json": {
      "get": {
        "operationId": "getStatus",
        "summary": "Freshness of the published datasets",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SyringeReference": {
        "type": "object",
        "required": [
          "scales",
          "barrels"
        ],
        "properties": {
          "scales": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SyringeScale"
            }
          },
          "barrels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Barrel"
            }
          },
          "boundary": {
            "$ref": "#/components/schemas/Boundary"
          }
        }
      },
      "SyringeScale": {
        "type": "object",
        "required": [
          "id",
          "units_per_ml",
          "ml_per_unit"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "U-100"
            ]
          },
          "label": {
            "type": "string"
          },
          "units_per_ml": {
            "type": "number",
            "examples": [
              100
            ]
          },
          "ml_per_unit": {
            "type": "number",
            "examples": [
              0.01
            ],
            "description": "Volume of one mark. The whole point of the dataset."
          },
          "description": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Barrel": {
        "type": "object",
        "properties": {
          "capacity_ml": {
            "type": "number",
            "examples": [
              0.3
            ]
          },
          "u100_capacity_units": {
            "type": "integer",
            "examples": [
              30
            ]
          },
          "graduation_note": {
            "type": "string",
            "description": "Graduation interval is product-specific. The capacity is fixed; the line spacing is not."
          }
        }
      },
      "FormulaSet": {
        "type": "object",
        "properties": {
          "formulas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Formula"
            }
          },
          "readability_thresholds": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Formula": {
        "type": "object",
        "required": [
          "id",
          "expression",
          "returns"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "concentration"
            ]
          },
          "name": {
            "type": "string"
          },
          "expression": {
            "type": "string",
            "examples": [
              "concentration_mg_per_ml = vial_mg / diluent_ml"
            ]
          },
          "variables": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "returns": {
            "type": "string",
            "examples": [
              "mg/mL"
            ]
          },
          "worked": {
            "type": "string",
            "description": "One example carried end to end."
          },
          "source": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Boundary": {
        "type": "object",
        "description": "What this data answers and what it refuses. Present in every payload because a retrieved JSON object travels alone.",
        "properties": {
          "answers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "refuses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "standing_caveats": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Human-readable API documentation",
    "url": "https://dosyne.com/api/"
  }
}
