{
  "openapi": "3.1.1",
  "info": {
    "title": "Pocketlab Light \u0026 Exposure Converter (lux ↔ EV ↔ shutter) API",
    "version": "1.0.0",
    "summary": "Convert lux to exposure value and back, and get shutter speeds for common f-numbers.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://pocketlablightexposure.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert lux to exposure value and back, and get shutter speeds for common f-numbers.",
        "description": "Converts an illuminance in lux into the photographic exposure value (EV at ISO 100) and back, or works out the EV of camera settings, with a table of shutter speeds for common apertures and an everyday comparison. It is the arithmetic behind the Pocketlab light meter, which estimates lux from the phone camera or a light sensor.\n\nMethodology:\n- Incident-light calibration with the meter constant C = 250: EV100 = log2(E × 100 / 250), so E = 2.5 × 2^EV100 lux.\n- Camera settings: EV100 = log2(N² / t) − log2(ISO / 100). The scene is then assumed to be average (18 % grey), so the lux figure is a rough estimate — the same assumption every reflected-light meter makes.\n- Shutter speeds for the f-numbers in the table: t = N² / 2^(EV100 + log2(ISO / 100)), rounded to the nearest standard speed.\n\nPhones are not calibrated light meters; expect about a factor of two. For workplace lighting checks use a calibrated lux meter.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "pocketlab_light_exposure",
        "x-owner-app": "pocketlab",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PocketlabLightExposureInput"
              },
              "examples": {
                "example1": {
                  "summary": "Office desk at 500 lx",
                  "value": {
                    "mode": "lux",
                    "lux": 500,
                    "iso": 100
                  }
                },
                "example2": {
                  "summary": "Sunny 16: EV 15 in lux",
                  "value": {
                    "mode": "ev",
                    "ev": 15,
                    "iso": 100
                  }
                },
                "example3": {
                  "summary": "Camera at f/2.8, 1/60 s, ISO 800",
                  "value": {
                    "mode": "camera",
                    "fNumber": 2.8,
                    "shutter": 0.016666666666666666,
                    "iso": 800
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PocketlabLightExposureResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PocketlabLightExposureInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "I have",
            "type": "string",
            "enum": [
              "lux",
              "ev",
              "camera"
            ],
            "default": "lux"
          },
          "lux": {
            "title": "Illuminance",
            "type": "number",
            "minimum": 0.001,
            "maximum": 1000000,
            "default": 500,
            "x-unit": "lx"
          },
          "ev": {
            "title": "Exposure value",
            "type": "number",
            "minimum": -10,
            "maximum": 25,
            "default": 10,
            "x-unit": "EV"
          },
          "fNumber": {
            "title": "f-number",
            "description": "Camera mode: the aperture used. The shutter table always uses ISO below.",
            "type": "number",
            "minimum": 0.7,
            "maximum": 64,
            "default": 2.8
          },
          "shutter": {
            "title": "Exposure time",
            "description": "Camera mode: e.g. 0.008 for 1/125 s.",
            "type": "number",
            "minimum": 0.00001,
            "maximum": 3600,
            "default": 0.008,
            "x-unit": "s"
          },
          "iso": {
            "title": "ISO",
            "type": "number",
            "minimum": 1,
            "maximum": 1000000,
            "default": 100
          }
        },
        "required": []
      },
      "PocketlabLightExposureResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "lux",
              "ev100",
              "evAtIso",
              "iso",
              "example",
              "shutters"
            ],
            "properties": {
              "lux": {
                "type": "number"
              },
              "ev100": {
                "type": "number"
              },
              "evAtIso": {
                "type": "number"
              },
              "iso": {
                "type": "number"
              },
              "example": {
                "type": "string"
              },
              "shutters": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "fNumber",
                    "seconds",
                    "text"
                  ],
                  "properties": {
                    "fNumber": {
                      "type": "number"
                    },
                    "seconds": {
                      "type": "number"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}