# POST /v1/saved-shapes Save a shape a consumer drew. | Access | | | --- | --- | | Keys | publishable or secret | | Plan | Premium | | Environment | live and sandbox | | Acts for | one consumer | | While the account is suspended | refused | | During a data stop | works | ## Headers | Name | Description | | --- | --- | | `X-Client-Token` | With a publishable key: **required.** A token your server minted for the consumer with [`POST /v1/client-tokens`](create-client-token.md). | | `X-Client-Id` | With a secret key: **required.** Your own opaque ID for the consumer. | | `Idempotency-Key` | A new random value for this action, such as a UUID. A repeat with the same value and the same request gets the first answer again, and nothing is saved twice ([idempotency](../../concepts/idempotency.md)). | ## Body | Field | Type | Description | | --- | --- | --- | | `name` | string | (optional) A name for the shape, 1 to 100 characters. | | `geometry` | [DrawnShape](../objects.md#drawnshape) | | ```json { "name": "Near the station", "geometry": { "type": "Polygon", "coordinates": [ [ [ -75.301, 40.009 ], [ -75.299, 40.009 ], [ -75.299, 40.011 ], [ -75.301, 40.011 ], [ -75.301, 40.009 ] ] ] } } ``` ## Answers ### 201: Saved The answer is `{ data, meta }`; `meta` holds `requestId` and `environment`. `data` is a [SavedShape](../objects.md#savedshape). ## Errors | Status | Codes | | --- | --- | | 400 | [`client_id_must_be_opaque`](../../errors/client_id_must_be_opaque.md), [`shape_invalid`](../../errors/shape_invalid.md), [`shape_too_large`](../../errors/shape_too_large.md), [`validation_failed`](../../errors/validation_failed.md) | | 401 | [`client_token_account_mismatch`](../../errors/client_token_account_mismatch.md), [`client_token_expired`](../../errors/client_token_expired.md), [`client_token_invalid`](../../errors/client_token_invalid.md), [`client_token_required`](../../errors/client_token_required.md), [`invalid_api_key`](../../errors/invalid_api_key.md), [`key_revoked`](../../errors/key_revoked.md), [`missing_api_key`](../../errors/missing_api_key.md) | | 403 | [`account_pending`](../../errors/account_pending.md), [`account_suspended`](../../errors/account_suspended.md), [`origin_not_allowed`](../../errors/origin_not_allowed.md), [`secret_key_in_browser`](../../errors/secret_key_in_browser.md), [`tier_insufficient`](../../errors/tier_insufficient.md) | | 409 | [`idempotency_conflict`](../../errors/idempotency_conflict.md), [`limit_reached`](../../errors/limit_reached.md) | | 429 | [`rate_limited`](../../errors/rate_limited.md) | | 500 | [`internal_error`](../../errors/internal_error.md), [`temporarily_unavailable`](../../errors/temporarily_unavailable.md) | Every error has the same body, and says how to fix it ([responses and errors](../../concepts/responses-and-errors.md)). ## More Request: ```json { "name": "Near the station", "geometry": { "type": "Polygon", "coordinates": [[[-75.301, 40.009], [-75.299, 40.009], [-75.299, 40.011], [-75.301, 40.011], [-75.301, 40.009]]] } } ``` `name` is optional, 1 to 100 characters. Response `201`: ```json { "data": { "id": "shp_…", "name": "Near the station", "geometry": { "type": "Polygon", "coordinates": [[[-75.301, 40.009], [-75.299, 40.009], [-75.299, 40.011], [-75.301, 40.011], [-75.301, 40.009]]] }, "vertices": 4, "areaSqKm": 0.037872, "createdAt": "2026-11-11T15:00:00.000Z" }, "meta": { "requestId": "req_…", "environment": "test" } } ``` - `vertices` counts corners: the ring's closing position, which repeats the first, isn't one. A position that repeats the one before it is dropped. - `areaSqKm` is the area on the Earth's surface (WGS84). - A shape that isn't acceptable is `400 shape_invalid` or `400 shape_too_large`, naming the field `geometry` and a `reason`; see [drawn shapes](../../concepts/shapes.md). Anything else wrong with the body (an unknown key, a bad name, no `geometry`) is `400 validation_failed`. - The 101st shape is `409 limit_reached`. - `Idempotency-Key` is accepted: see [idempotency](../../concepts/idempotency.md). - Refused with `403 account_suspended` while the account is suspended. _This page is made from the route's own declaration by `npm run openapi`. To change it, change the declaration or its explanation, never this file._