{"uid":"cap_jLzjicu3qRejgPEupjSvz","slug":"2s-io-ae2885d1","name":"2s.io Sunrise/Sunset Solar Times Calculator","description":"Compute sunrise, sunset, solar noon, and civil/nautical/astronomical twilight times for a coordinate + date. Query: lat (-90..90), lon (-180..180), date (YYYY-MM-DD). All times returned as ISO 8601 UTC. At high latitudes near solstices an event may not occur (polar day/night) — those fields return null and a note is included. dayLengthMinutes is the sunrise→sunset interval.","url":"https://2s.io/api/sunrise/compute","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","queryParams"],"properties":{"type":{"const":"http"},"method":{"const":"GET"},"queryParams":{"type":"object","required":["lat","lon","date"],"properties":{"lat":{"type":"number","maximum":90,"minimum":-90},"lon":{"type":"number","maximum":180,"minimum":-180},"date":{"type":"string"}},"additionalProperties":false}}}}},"responseSchema":{"type":"json","schema":{"type":"object","required":["ok","items","total","source"],"properties":{"ok":{"enum":[true],"type":"boolean"},"meta":{"type":"object","required":["query"],"properties":{"query":{"type":"object","required":["latitude","longitude","date"],"properties":{"date":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"}},"additionalProperties":false}},"additionalProperties":false},"items":{"type":"array","items":{"type":"object","additionalProperties":{}}},"total":{"type":"integer","nullable":true,"description":"Total matching rows upstream; null when unknown."},"source":{"type":"object","required":["provider","url","license"],"properties":{"url":{"type":"string"},"license":{"type":"string"},"provider":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},"example":{"ok":true,"meta":{"query":{"date":"example","latitude":1,"longitude":1}},"items":[{}],"total":1,"source":{"url":"example","license":"example","provider":"example"}}},"example":{"request":{"input":{"type":"http","method":"GET","queryParams":{"lat":40.7128,"lon":-74.006,"date":"2025-06-21"}}},"response":{"data":{"notes":[],"query":{"date":"2025-06-21","latitude":40.7128,"longitude":-74.006},"source":{"note":"Times are computed locally — no upstream call.","algorithm":"NOAA Solar Calculator (Meeus, Astronomical Algorithms 2nd ed.)"},"sunset":"2025-06-22T00:30:00.000Z","sunrise":"2025-06-21T09:25:00.000Z","solarNoon":"2025-06-21T16:57:00.000Z","civilTwilightEnd":"2025-06-22T01:04:00.000Z","dayLengthMinutes":905,"civilTwilightBegin":"2025-06-21T08:51:00.000Z","nauticalTwilightEnd":"2025-06-22T01:46:00.000Z","nauticalTwilightBegin":"2025-06-21T08:08:00.000Z","astronomicalTwilightEnd":"2025-06-22T02:37:00.000Z","astronomicalTwilightBegin":"2025-06-21T07:18:00.000Z"},"meta":{"cost":{"usd":0.001,"tier":0},"caller":"x402","version":null,"endpoint":"sunrise.compute","settlement":{"txHash":"0x0a116dfc57aac3b006440eeacbeb2bf10e7b84d6e61d568ed8e6959a20c67f0f","network":"eip155:8453","success":true}}}},"exampleRequest":{"lat":40.7128,"lon":-74.006,"date":"2025-06-21"},"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0025","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0025","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_L7JdVXd_6D2ehVVZRauPC","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0025","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes sunrise, sunset, solar noon, and twilight times (civil, nautical, astronomical) for a geographic coordinate and date, returned in UTC ISO 8601","exampleAgentPrompt":"What time does the sun rise and set in Reykjavik (lat 64.1355, lon -21.8954) on December 21, 2025, and how long is the day? Also give me civil and nautical twilight times.","exampleUseCases":null,"resultDescription":"Returns ISO 8601 UTC timestamps for sunrise, sunset, solar noon, civil twilight start/end, nautical twilight start/end, and astronomical twilight start/end, plus dayLengthMinutes (sunrise-to-sunset interval). At extreme latitudes near solstices, events that don't occur (polar day/night) return null with an explanatory note.","failureModes":["Invalid latitude outside -90..90 returns validation error","Invalid longitude outside -180..180 returns validation error","Date not in YYYY-MM-DD format returns parse error","At high latitudes near solstice, some or all events return null with polar day/night note","Missing required parameters (lat, lon, date) returns 400-level error","Payment not included or insufficient results in 402 Payment Required"],"whenToPreferThis":"Use this endpoint when you need precise, programmatically computed solar event times (sunrise, sunset, twilight phases) for any global coordinate and date — especially when you need all twilight categories (civil, nautical, astronomical) in a single call, or when handling edge cases like polar regions where events may not occur.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:54:03.273Z","isFirstParty":false}