Floor plans

Floor Plan API

Turn a sketch, photo or scan of a floor plan into a clean, editable 2D floor plan with one call. 5 credits per plan, saved in the property you choose.

Send a sketch, a photo or a scan of a floor plan and get back a clean 2D floor plan. Pedra reads the walls, doors, windows and room names, straightens them and draws a plan with the measurements written on the drawing. The plan is saved in a property, so your users can open it in Pedra and edit it like one they drew themselves.

Cost

5 credits per plan, charged only when a plan comes out. A reading that fails is free. If the account has fewer than 5 credits, the call is refused before anything runs, with a 403 that says so.

Where the plan is saved

Like images and videos: pass propertyId to add the plan to one of your properties (from list_properties or create_property). Leave it out and Pedra creates a new property, named with propertyName. The response always carries the propertyId and an appUrl that opens it in Pedra.

Create a floor plan

POST/api/create_floor_plan

Reading a drawing takes about 1 to 3 minutes. By default the call waits and returns the finished plan (the connection is kept alive while it works). Pass "waitForCompletion": false to get a floorPlanId straight away and poll floor_plan_status instead.

apiKeystringrequired
Your API key.
imageUrlstringrequired
The sketch, photo or scan of the floor plan: a public URL or a base64 data URL. JPEG, PNG or WebP, up to 12 MB.
propertyIdstring
Property to save the plan in. Leave it out to create a new property.
propertyNamestring
Name of the new property, when no propertyId is passed. Defaults to the plan's name.
namestring
Name of the plan, printed under it, e.g. "Ground floor".
Default: Floor plan
unitsstring
Units for the measurements.
Values: metric imperial
Default: metric
waitForCompletionboolean
false returns a floorPlanId at once; poll floor_plan_status for the result.
Default: true
curl -X POST https://app.pedra.ai/api/create_floor_plan \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_API_KEY",
    "imageUrl": "https://example.com/sketches/calle-mayor-12.jpg",
    "propertyId": "196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
    "name": "Ground floor"
  }'

Response

JSON
{
  "message": "Floor plan created",
  "floorPlanId": "Ae6pgFD6yZyyhpzZH",
  "propertyId": "196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
  "name": "Ground floor",
  "status": "ready",
  "imageUrl": "https://img.pedra.ai/floorplan-source-QiqMn78cKtNHk4LpF",
  "appUrl": "https://app.pedra.ai/?projectId=196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
  "creditsUsed": 5
}
# 1. Start the conversion (returns at once with "status": "processing")
curl -X POST https://app.pedra.ai/api/create_floor_plan \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_API_KEY",
    "imageUrl": "https://example.com/sketches/calle-mayor-12.jpg",
    "propertyName": "Calle Mayor 12",
    "waitForCompletion": false
  }'

# 2. Poll every 10 seconds until "status" is "ready" (or "failed")
curl -X POST https://app.pedra.ai/api/floor_plan_status \
  -H "Content-Type: application/json" \
  -d '{ "apiKey": "YOUR_API_KEY", "floorPlanId": "FLOOR_PLAN_ID" }'
JSON
{
  "message": "Floor plan conversion started",
  "floorPlanId": "Ae6pgFD6yZyyhpzZH",
  "propertyId": "196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
  "name": "Ground floor",
  "status": "processing",
  "appUrl": "https://app.pedra.ai/?projectId=196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04"
}

Floor plan status

POST/api/floor_plan_status

Returns "processing", "ready" (with imageUrl) or "failed". Never spends credits.

apiKeystringrequired
Your API key.
floorPlanIdstringrequired
Id returned by create_floor_plan.
curl -X POST https://app.pedra.ai/api/floor_plan_status \
  -H "Content-Type: application/json" \
  -d '{ "apiKey": "YOUR_API_KEY", "floorPlanId": "FLOOR_PLAN_ID" }'

Response

JSON
{
  "floorPlanId": "Ae6pgFD6yZyyhpzZH",
  "propertyId": "196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
  "name": "Ground floor",
  "status": "ready",
  "imageUrl": "https://img.pedra.ai/floorplan-source-QiqMn78cKtNHk4LpF",
  "appUrl": "https://app.pedra.ai/?projectId=196e742a-5b0d-4c9e-8a3f-7e2b1c6d9f04",
  "creditsUsed": 5
}

Getting a good plan

  • Write at least one real measurement on the drawing (a wall length, or the total area). Without one, the layout comes out right but without sizes.
  • Label each room. The names are carried onto the plan as written.
  • Photograph the sheet from above, flat and well lit. Images are scaled down to 2400 px on the long side, so bigger files buy nothing.

Errors

  • 400 missing imageUrl, or the URL is not an image.
  • 403 not enough credits (5 needed).
  • 404 unknown API key, or a propertyId / floorPlanId that is not in this account.
  • 409 the property already holds 30 floor plans.
  • 500 the drawing could not be read. Nothing is charged and no plan is left behind.

From ChatGPT or Claude

The same endpoints are the pedra_create_floor_plan and pedra_get_floor_plan tools in the Pedra MCP server. Attach a photo of the sketch in the chat and ask for the plan.