{"openapi":"3.1.0","info":{"title":"Bragg Diffraction API","version":"1.0.0","description":"X-ray crystallography maths as an API, computed locally and deterministically. The angle endpoint applies Bragg’s law, n·λ = 2·d·sinθ, to give the diffraction angle θ and the experimentally plotted 2θ from a crystal’s inter-planar spacing and the X-ray wavelength, defaulting to the common Cu Kα source at 0.15406 nm and reporting the highest observable order ⌊2d/λ⌋ — a 0.2 nm plane spacing diffracts Cu Kα to θ ≈ 22.65°, a 2θ peak near 45.3°. The spacing endpoint inverts the law, d = n·λ/(2·sinθ), reading the lattice spacing straight off a measured XRD peak — the everyday job of indexing a diffraction pattern, so a 2θ of 31.77° for table salt gives the 0.2814 nm (200) spacing. The wavelength endpoint solves λ = 2·d·sinθ/n to identify or calibrate the source. Lengths are entered in nanometres or ångström and angles in degrees, and any diffraction order n is supported. Everything is computed locally and deterministically, so it is instant and private. Ideal for materials-science, crystallography, mineralogy, XRD, semiconductor and solid-state-physics app developers, lattice-spacing and pattern-indexing tools, and laboratory software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is reflection-geometry Bragg diffraction with the 2d factor; for optical double-slit and grating diffraction use a wave-optics diffraction API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/bragg-api","description":"oanor gateway"}],"tags":[{"name":"Bragg"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/angle":{"get":{"operationId":"get_v1_angle","tags":["Bragg"],"summary":"Bragg angle from spacing","description":"","parameters":[{"name":"spacing_nm","in":"query","required":false,"description":"Inter-planar spacing d (nm)","schema":{"type":"string"},"example":"0.2"},{"name":"spacing_angstrom","in":"query","required":false,"description":"d-spacing (ångström)","schema":{"type":"string"}},{"name":"wavelength_nm","in":"query","required":false,"description":"Wavelength (nm, default Cu Kα 0.15406)","schema":{"type":"string"}},{"name":"order","in":"query","required":false,"description":"Diffraction order n","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Bragg's law n·λ = 2·d·sinθ. θ is the glancing angle from the planes; XRD patterns are plotted against 2θ. Default wavelength is Cu Kα = 0.15406 nm.","inputs":{"order":1,"spacing_nm":0.2,"wavelength_nm":0.15406},"max_order":2,"theta_deg":22.653053,"two_theta_deg":45.306106},"meta":{"timestamp":"2026-06-05T19:50:23.738Z","request_id":"4c0f0c3e-e224-4083-97e6-35875f0ef856"},"status":"ok","message":"Bragg angle","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/spacing":{"get":{"operationId":"get_v1_spacing","tags":["Bragg"],"summary":"d-spacing from angle","description":"","parameters":[{"name":"two_theta","in":"query","required":false,"description":"Measured 2θ (deg)","schema":{"type":"string"},"example":"45.31"},{"name":"theta","in":"query","required":false,"description":"Or θ (deg)","schema":{"type":"string"}},{"name":"wavelength_nm","in":"query","required":false,"description":"Wavelength (nm, default Cu Kα)","schema":{"type":"string"}},{"name":"order","in":"query","required":false,"description":"Diffraction order n","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Inter-planar spacing d = n·λ/(2·sinθ). This is how a crystal's lattice spacing is read off an XRD peak.","inputs":{"order":1,"theta_deg":22.655,"wavelength_nm":0.15406},"spacing_nm":0.19998371,"spacing_angstrom":1.999837},"meta":{"timestamp":"2026-06-05T19:50:23.819Z","request_id":"36c08afd-efaf-4aef-8304-2ec7eef4eef5"},"status":"ok","message":"d-spacing","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/wavelength":{"get":{"operationId":"get_v1_wavelength","tags":["Bragg"],"summary":"Wavelength from spacing & angle","description":"","parameters":[{"name":"spacing_nm","in":"query","required":false,"description":"d-spacing (nm)","schema":{"type":"string"},"example":"0.2"},{"name":"spacing_angstrom","in":"query","required":false,"description":"d-spacing (ångström)","schema":{"type":"string"}},{"name":"two_theta","in":"query","required":false,"description":"2θ (deg)","schema":{"type":"string"},"example":"45.31"},{"name":"theta","in":"query","required":false,"description":"Or θ (deg)","schema":{"type":"string"}},{"name":"order","in":"query","required":false,"description":"Order n","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Wavelength λ = 2·d·sinθ/n — used to calibrate or identify the X-ray source from a known reflection.","inputs":{"order":1,"theta_deg":22.655,"spacing_nm":0.2},"wavelength_nm":0.15407255,"wavelength_angstrom":1.540725},"meta":{"timestamp":"2026-06-05T19:50:23.900Z","request_id":"61d2dadc-7021-4c5e-9e3a-2f501f36f036"},"status":"ok","message":"Wavelength","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"notes":"Lengths in nm or ångström, angles in degrees. Reflection (Bragg) geometry with the 2d factor; for optical double-slit/grating diffraction use a wave-optics diffraction API.","service":"bragg-api","constants":{"cu_k_alpha_nm":0.15406},"endpoints":{"GET /v1/meta":"This document.","GET /v1/angle":"Bragg angle θ and 2θ from d-spacing and wavelength.","GET /v1/spacing":"Inter-planar spacing from the Bragg angle.","GET /v1/wavelength":"Wavelength from spacing and angle."},"description":"Bragg's law for X-ray crystallography: diffraction angle, inter-planar d-spacing and wavelength from n·λ = 2·d·sinθ."},"meta":{"timestamp":"2026-06-05T19:50:23.973Z","request_id":"b6ed4da5-044e-46d4-b43a-c553f33c0581"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":3500,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":620,"monthly_call_quota":33000,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1880,"monthly_call_quota":168000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":5900,"monthly_call_quota":1020000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/bragg-api"}