Base URL
https://api.solargenix.ai
Authentication
All requests to the public layout API require an access token. Send the token in theToken header:
Access Token Generation
Access tokens are generated from the SolarGenix Developer page. Token issuance is managed in the SolarGenix interface and is not exposed as a public API endpoint.Token generation flow
- Sign in to the SolarGenix interface.
- Open the Developer page.
- Select Generate Token.
- Copy the generated token and store it securely.
- Use the token in the
Tokenrequest header for all public API calls.
Token handling requirements
- Store tokens on your server side only.
- Do not expose tokens in client-side JavaScript, mobile bundles, or public repositories.
- Rotate the token immediately if it is exposed.
- Use a different token for each environment when possible.
Endpoint
POST /v1/layout/
Generates a roof layout and candidate panel placements for the requested property.
Full URL:
Request Headers
| Header | Required | Value | Description |
|---|---|---|---|
Token | Yes | string | Public API access token generated in the SolarGenix Developer page |
Content-Type | Yes | application/json | Request payload format |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Latitude of the property |
lng | number | Yes | Longitude of the property |
measurement_system | string | Yes | Unit system for all dimensional input values. Allowed values: metric, imperial |
panel_size_w | number | Yes | Panel width in the selected measurement system |
panel_size_h | number | Yes | Panel height in the selected measurement system |
setback | object | Yes | Required roof-edge setback configuration |
setback.eave | number | Yes | Setback from eave edges |
setback.ridge | number | Yes | Setback from ridge edges |
setback.hipvalley | number | Yes | Setback from hip and valley edges |
setback.rake | number | Yes | Setback from rake edges |
panel_spacing | number | Yes | Spacing between adjacent panels in the selected measurement system |
calculate_production | boolean | Yes | When true, panel candidates include production-related values such as flux |
Measurement Rules
- When
measurement_systemismetric, all dimensional request values must be sent in meters. - When
measurement_systemisimperial, all dimensional request values must be sent in feet. - Use one system consistently for
panel_size_w,panel_size_h, allsetbackvalues, andpanel_spacing.
Request Example
JavaScript Example
Success Response
The API returns a JSON object containing the source image and all detected roof geometry required to render candidate panel placements.Response Field Reference
Root Object
| Field | Type | Description |
|---|---|---|
map_image | string | URL of the source map or imagery used for layout rendering |
obstacles | array<object> | Detected rooftop obstructions that should be avoided during placement |
panel_size | array<number, number> | Normalized panel width and height used for rendering over map_image |
roof_segments | array<object> | Detected roof planes with boundaries, orientation data, and candidate panel placements |
obstacles[]
| Field | Type | Description |
|---|---|---|
x | number | Horizontal position of the obstacle in normalized image coordinates |
y | number | Vertical position of the obstacle in normalized image coordinates |
size | number | Relative obstacle footprint size in normalized image coordinates |
roof_segments[]
| Field | Type | Description |
|---|---|---|
cycle | array<object> | Closed polygon describing the roof segment boundary |
angle | number | Rotation angle used for segment-aligned panel placement calculations |
azimuth | number | Compass direction of the roof surface in degrees |
tilt | number | Roof tilt in degrees |
panels_portrait | array<object> | Candidate panel centers for portrait orientation |
panels_landscape | array<object> | Candidate panel centers for landscape orientation |
roof_segments[].cycle[]
| Field | Type | Description |
|---|---|---|
x | number | Horizontal position of a boundary point in normalized image coordinates |
y | number | Vertical position of a boundary point in normalized image coordinates |
roof_segments[].panels_portrait[]
| Field | Type | Description |
|---|---|---|
x | number | Horizontal center position of the candidate panel in normalized image coordinates |
y | number | Vertical center position of the candidate panel in normalized image coordinates |
flux | number | Production-related solar flux value for the panel candidate. Present when calculate_production is enabled |
roof_segments[].panels_landscape[]
| Field | Type | Description |
|---|---|---|
x | number | Horizontal center position of the candidate panel in normalized image coordinates |
y | number | Vertical center position of the candidate panel in normalized image coordinates |
flux | number | Production-related solar flux value for the panel candidate. Present when calculate_production is enabled |
Coordinate System and Rendering Rules
The response uses normalized image coordinates for layout rendering.xandyvalues are relative to the image and typically fall in the range0.0to1.0.panel_sizeis also normalized and must be converted before rendering.cycle,obstacles,panels_portrait, andpanels_landscapeall use the same normalized coordinate system.
Pixel conversion
To draw the result on top of the returnedmap_image, convert coordinates using the final rendered image dimensions:
Important note
Do not treat response placement coordinates as raw pixels. They are normalized placement values intended to be scaled against the final image size.Common Implementation Notes
- Use
panels_portraitwhen you want portrait candidate placement. - Use
panels_landscapewhen you want landscape candidate placement. - Use
fluxto rank candidate placements when production scoring is enabled. - Use
cycleto draw or clip the roof segment boundary. - Use
obstaclesto block placements or visually mark non-usable rooftop areas.
HTTP Status Expectations
| Status | Meaning |
|---|---|
200 OK | Layout generated successfully |
400 Bad Request | Request body is invalid or required values are missing |
401 Unauthorized | Token header is missing or invalid |
422 Unprocessable Entity | The property could not be processed into a usable roof layout |
500 Internal Server Error | Unexpected processing failure |