{
  "x402Version": 2,
  "id": 6759,
  "slug": "6759",
  "resource": "https://api.geoprimitives.dev/v1/geometry/difference",
  "description": "Cut holes out of a polygon: the buildable part of a parcel once setbacks are removed, the land outside a protected area, the part of a route not already covered. Order is significant, so this is the one overlay op where swapping the operands gives a different answer. Subtracting everything answers geojson:null with empty:true, a real answer rather than an error. Send a FeatureCollection of Polygons or MultiPolygons; the first member in document order has every later member subtracted from it. The answer is a single Feature, or null with empty:true when nothing survives. Clipping is planar in longitude/latitude, so edges are straight in degrees rather than geodesics. The 2000-position cap is CPU rather than bandwidth: the sweep-line overlay is quadratic on self-intersecting input. Input is EPSG:4326 only. Limits: 2000 positions across all members, 1 MiB request body, and at least two polygonal geometries or the call is refused.",
  "type": "http",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x76A51b5Dd3729950B3b60c17f19252d221968FCe",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "10000",
      "maxTimeoutSeconds": 300
    }
  ],
  "outputSchema": {
    "bazaar": {
      "info": {
        "input": {
          "body": {
            "geojson": {
              "features": [
                {
                  "geometry": {
                    "coordinates": [
                      [
                        [
                          -150,
                          61
                        ],
                        [
                          -149.9,
                          61
                        ],
                        [
                          -149.9,
                          61.1
                        ],
                        [
                          -150,
                          61.1
                        ],
                        [
                          -150,
                          61
                        ]
                      ]
                    ],
                    "type": "Polygon"
                  },
                  "properties": null,
                  "type": "Feature"
                },
                {
                  "geometry": {
                    "coordinates": [
                      [
                        [
                          -149.95,
                          61.05
                        ],
                        [
                          -149.85,
                          61.05
                        ],
                        [
                          -149.85,
                          61.15
                        ],
                        [
                          -149.95,
                          61.15
                        ],
                        [
                          -149.95,
                          61.05
                        ]
                      ]
                    ],
                    "type": "Polygon"
                  },
                  "properties": null,
                  "type": "Feature"
                }
              ],
              "type": "FeatureCollection"
            }
          },
          "bodyType": "json",
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "empty": false,
            "geojson": {
              "geometry": {
                "coordinates": [
                  [
                    [
                      -150,
                      61
                    ],
                    [
                      -149.9,
                      61
                    ],
                    [
                      -149.9,
                      61.05
                    ],
                    [
                      -149.95,
                      61.05
                    ],
                    [
                      -149.95,
                      61.1
                    ],
                    [
                      -150,
                      61.1
                    ],
                    [
                      -150,
                      61
                    ]
                  ]
                ],
                "type": "Polygon"
              },
              "properties": null,
              "type": "Feature"
            },
            "inputGeometries": 2,
            "inputVertices": 10,
            "notes": [
              "The first geometry in document order had every later one subtracted from it.",
              "Vertices are treated as planar in longitude/latitude, which is what every polygon-clipping library does. Edges are straight in degrees, not geodesics; on edges spanning more than a degree or so the two differ."
            ],
            "op": "difference",
            "outputVertices": 7
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "additionalProperties": false,
                "properties": {
                  "geojson": {
                    "description": "A GeoJSON FeatureCollection or GeometryCollection holding two or more Polygons or MultiPolygons in EPSG:4326. The first is the minuend and every later one is subtracted from it. At most 2000 positions across all members. Anything non-polygonal is rejected.",
                    "type": "object"
                  }
                },
                "required": [
                  "geojson"
                ],
                "type": "object"
              },
              "bodyType": {
                "enum": [
                  "json",
                  "form-data",
                  "text"
                ],
                "type": "string"
              },
              "method": {
                "enum": [
                  "POST"
                ],
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "method",
              "bodyType",
              "body"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "bazaar"
  ],
  "sourceHost": "api.geoprimitives.dev",
  "lastUpdated": "2026-08-21T17:25:59.287Z",
  "quality": {
    "calls30d": 1,
    "uniquePayers30d": 1,
    "lastCalledAt": "2026-08-21T17:25:59.175Z"
  },
  "liveness": {},
  "verified": false,
  "featured": false,
  "provider": {
    "host": "api.geoprimitives.dev",
    "manifest_name": "api.geoprimitives.dev",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-09-18T22:00:31.484Z"
  }
}