> For the complete documentation index, see [llms.txt](https://docs.matrixian.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matrixian.com/woningdata/bag-api.md).

# BAG API

## GET /bag-data

> Returns data from the Basic Registration of Addresses and Buildings (BAG) after entering the postal code and house number.

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"servers":[{"url":"https://api.matrixian.com/v1","description":"Matrixian API"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"{{API_KEY}}"}},"schemas":{"AddressInput":{"properties":{"postalCode":{"type":"string","title":"Postalcode","description":"Postal code"},"houseNumber":{"type":"integer","title":"Housenumber","description":"House number"},"houseLetter":{"title":"Houseletter","description":"House letter","type":"string","nullable":true},"houseNumberExt":{"title":"Housenumberext","description":"House number extension","type":"string","nullable":true}},"type":"object","required":["postalCode","houseNumber"],"title":"AddressInput"},"BagDataResponse":{"properties":{"building":{"description":"Building","allOf":[{"$ref":"#/components/schemas/Building"}]},"numberDesignation":{"description":"Number designation","allOf":[{"$ref":"#/components/schemas/NumberDesignation"}]},"object":{"description":"Object","allOf":[{"$ref":"#/components/schemas/Object"}]},"place":{"description":"Place","allOf":[{"$ref":"#/components/schemas/Place"}]},"publicSpace":{"description":"Public space","allOf":[{"$ref":"#/components/schemas/PublicSpace"}]},"sourceHolder":{"description":"Source holder","allOf":[{"$ref":"#/components/schemas/SourceHolder"}]}},"type":"object","required":["building","numberDesignation","object","place","publicSpace","sourceHolder"],"title":"BagDataResponse"},"Building":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"buildYear":{"description":"Indication of the year in which the building will originally be delivered in, or is architecturally ready. Also known as construction year.","title":"Buildyear","type":"integer"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutatation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated.","title":"Noted","type":"boolean"},"status":{"description":"Status of the building.","title":"Status","type":"string"}},"required":["beginDate","buildYear","documentDate","documentNumber","id","noted","status"],"title":"Building","type":"object"},"NumberDesignation":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"houseLetter":{"default":null,"description":"House letter","title":"Houseletter","type":"string","nullable":true},"houseNumber":{"description":"House number","title":"Housenumber","type":"integer"},"houseNumberExtension":{"default":null,"description":"House number extension","title":"Housenumberextension","type":"string","nullable":true},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"objectType":{"description":"Type of the object","title":"Objecttype","type":"string"},"postcode":{"description":"Postal code","title":"Postcode","type":"string"},"relatedPublicSpace":{"description":"Number of the public space it is related to.","title":"Relatedpublicspace","type":"string"},"status":{"description":"Status of the number designated.","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","houseNumber","id","noted","objectType","postcode","relatedPublicSpace","status"],"title":"NumberDesignation","type":"object"},"Object":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document.","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"location":{"description":"Location","allOf":[{"$ref":"#/components/schemas/Location"}]},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"relatedBuilding":{"description":"Number of the building it is related to","title":"Relatedbuilding","type":"string"},"relatedMainAddress":{"description":"Number of the address it is related to","title":"Relatedmainaddress","type":"string"},"status":{"description":"Status of the object.","title":"Status","type":"string"},"usePurpose":{"description":"Use function of the building","title":"Usepurpose","type":"string"},"useSurface":{"description":"Use surface of the building","title":"Usesurface","type":"integer"}},"required":["beginDate","documentDate","documentNumber","id","location","noted","relatedBuilding","relatedMainAddress","status","usePurpose","useSurface"],"title":"Object","type":"object"},"Location":{"properties":{"x":{"title":"X","type":"number"},"y":{"title":"Y","type":"number"}},"required":["x","y"],"title":"Location","type":"object"},"Place":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"name":{"description":"Name of the place","title":"Name","type":"string"},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"status":{"description":"Status of the place","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","id","name","noted","status"],"title":"Place","type":"object"},"PublicSpace":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"name":{"description":"Name of the public space","title":"Name","type":"string"},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"relatedPlace":{"description":"Number of the place it is related to","title":"Relatedplace","type":"string"},"status":{"description":"Status of the public space","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","id","name","noted","relatedPlace","status"],"title":"PublicSpace","type":"object"},"SourceHolder":{"properties":{"id":{"description":"Id of the source holder","title":"Id","type":"string"},"name":{"description":"Name of the source holder","title":"Name","type":"string"}},"required":["id","name"],"title":"SourceHolder","type":"object"},"ErrorObject":{"properties":{"code":{"type":"integer","title":"Code"},"message":{"type":"string","title":"Message"},"errors":{"items":{"$ref":"#/components/schemas/ErrorDetail"},"type":"array","title":"Errors"}},"type":"object","required":["code","message","errors"],"title":"ErrorObject"},"ErrorDetail":{"properties":{"reason":{"type":"string","title":"Reason"},"message":{"type":"string","title":"Message"}},"type":"object","required":["reason","message"],"title":"ErrorDetail"}}},"paths":{"/bag-data":{"get":{"description":"Returns data from the Basic Registration of Addresses and Buildings (BAG) after entering the postal code and house number.","operationId":"bagData","parameters":[{"description":"Postal code","required":true,"style":"form","explode":true,"schema":{"type":"string"},"name":"postalCode","in":"query"},{"description":"House number","required":true,"style":"form","explode":true,"schema":{"type":"integer"},"name":"houseNumber","in":"query"},{"description":"House letter","required":false,"style":"form","explode":true,"schema":{"type":"string"},"name":"houseLetter","in":"query"},{"description":"House number extension","required":false,"style":"form","explode":true,"schema":{"type":"string"},"name":"houseNumberExt","in":"query"}],"responses":{"200":{"description":"BagDataResponse","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","nullable":true},"params":{"$ref":"#/components/schemas/AddressInput"},"data":{"$ref":"#/components/schemas/BagDataResponse"},"error":{"additionalProperties":{"type":"string"},"type":"object"},"meta":{"additionalProperties":{"type":"string"},"type":"object","nullable":true},"status":{"type":"string"}},"type":"object","required":["data","status"]}}}},"400":{"description":"HTTP 400","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","nullable":true},"params":{"$ref":"#/components/schemas/AddressInput"},"data":{"additionalProperties":{"type":"string"},"type":"object"},"error":{"$ref":"#/components/schemas/ErrorObject"},"meta":{"additionalProperties":{"type":"string"},"type":"object","nullable":true},"status":{"type":"string"}},"type":"object","required":["error","status"]}}}},"401":{"description":"HTTP 401","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","nullable":true},"params":{"$ref":"#/components/schemas/AddressInput"},"data":{"additionalProperties":{"type":"string"},"type":"object"},"error":{"$ref":"#/components/schemas/ErrorObject"},"meta":{"additionalProperties":{"type":"string"},"type":"object","nullable":true},"status":{"type":"string"}},"type":"object","required":["error","status"]}}}},"403":{"description":"HTTP 403","content":{"application/json":{"schema":{"properties":{"message":{"type":"string"}},"type":"object","required":["message"]}}}},"404":{"description":"HTTP 404","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","nullable":true},"params":{"$ref":"#/components/schemas/AddressInput"},"data":{"additionalProperties":{"type":"string"},"type":"object"},"error":{"$ref":"#/components/schemas/ErrorObject"},"meta":{"additionalProperties":{"type":"string"},"type":"object","nullable":true},"status":{"type":"string"}},"type":"object","required":["error","status"]}}}},"500":{"description":"HTTP 500","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","nullable":true},"params":{"$ref":"#/components/schemas/AddressInput"},"data":{"additionalProperties":{"type":"string"},"type":"object"},"error":{"$ref":"#/components/schemas/ErrorObject"},"meta":{"additionalProperties":{"type":"string"},"type":"object","nullable":true},"status":{"type":"string"}},"type":"object","required":["error","status"]}}}}}}}}}
```

## The BagDataResponse object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"BagDataResponse":{"properties":{"building":{"description":"Building","allOf":[{"$ref":"#/components/schemas/Building"}]},"numberDesignation":{"description":"Number designation","allOf":[{"$ref":"#/components/schemas/NumberDesignation"}]},"object":{"description":"Object","allOf":[{"$ref":"#/components/schemas/Object"}]},"place":{"description":"Place","allOf":[{"$ref":"#/components/schemas/Place"}]},"publicSpace":{"description":"Public space","allOf":[{"$ref":"#/components/schemas/PublicSpace"}]},"sourceHolder":{"description":"Source holder","allOf":[{"$ref":"#/components/schemas/SourceHolder"}]}},"type":"object","required":["building","numberDesignation","object","place","publicSpace","sourceHolder"],"title":"BagDataResponse"},"Building":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"buildYear":{"description":"Indication of the year in which the building will originally be delivered in, or is architecturally ready. Also known as construction year.","title":"Buildyear","type":"integer"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutatation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated.","title":"Noted","type":"boolean"},"status":{"description":"Status of the building.","title":"Status","type":"string"}},"required":["beginDate","buildYear","documentDate","documentNumber","id","noted","status"],"title":"Building","type":"object"},"NumberDesignation":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"houseLetter":{"default":null,"description":"House letter","title":"Houseletter","type":"string","nullable":true},"houseNumber":{"description":"House number","title":"Housenumber","type":"integer"},"houseNumberExtension":{"default":null,"description":"House number extension","title":"Housenumberextension","type":"string","nullable":true},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"objectType":{"description":"Type of the object","title":"Objecttype","type":"string"},"postcode":{"description":"Postal code","title":"Postcode","type":"string"},"relatedPublicSpace":{"description":"Number of the public space it is related to.","title":"Relatedpublicspace","type":"string"},"status":{"description":"Status of the number designated.","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","houseNumber","id","noted","objectType","postcode","relatedPublicSpace","status"],"title":"NumberDesignation","type":"object"},"Object":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document.","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"location":{"description":"Location","allOf":[{"$ref":"#/components/schemas/Location"}]},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"relatedBuilding":{"description":"Number of the building it is related to","title":"Relatedbuilding","type":"string"},"relatedMainAddress":{"description":"Number of the address it is related to","title":"Relatedmainaddress","type":"string"},"status":{"description":"Status of the object.","title":"Status","type":"string"},"usePurpose":{"description":"Use function of the building","title":"Usepurpose","type":"string"},"useSurface":{"description":"Use surface of the building","title":"Usesurface","type":"integer"}},"required":["beginDate","documentDate","documentNumber","id","location","noted","relatedBuilding","relatedMainAddress","status","usePurpose","useSurface"],"title":"Object","type":"object"},"Location":{"properties":{"x":{"title":"X","type":"number"},"y":{"title":"Y","type":"number"}},"required":["x","y"],"title":"Location","type":"object"},"Place":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"name":{"description":"Name of the place","title":"Name","type":"string"},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"status":{"description":"Status of the place","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","id","name","noted","status"],"title":"Place","type":"object"},"PublicSpace":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"name":{"description":"Name of the public space","title":"Name","type":"string"},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"relatedPlace":{"description":"Number of the place it is related to","title":"Relatedplace","type":"string"},"status":{"description":"Status of the public space","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","id","name","noted","relatedPlace","status"],"title":"PublicSpace","type":"object"},"SourceHolder":{"properties":{"id":{"description":"Id of the source holder","title":"Id","type":"string"},"name":{"description":"Name of the source holder","title":"Name","type":"string"}},"required":["id","name"],"title":"SourceHolder","type":"object"}}}}
```

## The OpenbareRuimte object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"OpenbareRuimte":{"properties":{"openbareRuimteNaam":{"default":null,"title":"Openbareruimtenaam","maxLength":80,"minLength":1,"type":"string","nullable":true},"gerelateerdeWoonplaatsNaam":{"default":null,"title":"Gerelateerdewoonplaatsnaam","maxLength":80,"minLength":1,"type":"string","nullable":true}},"title":"OpenbareRuimte","type":"object"}}}}
```

## The Building object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"Building":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"buildYear":{"description":"Indication of the year in which the building will originally be delivered in, or is architecturally ready. Also known as construction year.","title":"Buildyear","type":"integer"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutatation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated.","title":"Noted","type":"boolean"},"status":{"description":"Status of the building.","title":"Status","type":"string"}},"required":["beginDate","buildYear","documentDate","documentNumber","id","noted","status"],"title":"Building","type":"object"}}}}
```

## The NumberDesignation object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"NumberDesignation":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"houseLetter":{"default":null,"description":"House letter","title":"Houseletter","type":"string","nullable":true},"houseNumber":{"description":"House number","title":"Housenumber","type":"integer"},"houseNumberExtension":{"default":null,"description":"House number extension","title":"Housenumberextension","type":"string","nullable":true},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"objectType":{"description":"Type of the object","title":"Objecttype","type":"string"},"postcode":{"description":"Postal code","title":"Postcode","type":"string"},"relatedPublicSpace":{"description":"Number of the public space it is related to.","title":"Relatedpublicspace","type":"string"},"status":{"description":"Status of the number designated.","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","houseNumber","id","noted","objectType","postcode","relatedPublicSpace","status"],"title":"NumberDesignation","type":"object"}}}}
```

## The Object object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"Object":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document.","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"location":{"description":"Location","allOf":[{"$ref":"#/components/schemas/Location"}]},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"relatedBuilding":{"description":"Number of the building it is related to","title":"Relatedbuilding","type":"string"},"relatedMainAddress":{"description":"Number of the address it is related to","title":"Relatedmainaddress","type":"string"},"status":{"description":"Status of the object.","title":"Status","type":"string"},"usePurpose":{"description":"Use function of the building","title":"Usepurpose","type":"string"},"useSurface":{"description":"Use surface of the building","title":"Usesurface","type":"integer"}},"required":["beginDate","documentDate","documentNumber","id","location","noted","relatedBuilding","relatedMainAddress","status","usePurpose","useSurface"],"title":"Object","type":"object"},"Location":{"properties":{"x":{"title":"X","type":"number"},"y":{"title":"Y","type":"number"}},"required":["x","y"],"title":"Location","type":"object"}}}}
```

## The Place object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"Place":{"properties":{"beginDate":{"description":"Beginning date","title":"Begindate","type":"string"},"documentDate":{"description":"Date of the document","title":"Documentdate","type":"string"},"documentNumber":{"description":"Number of the document","title":"Documentnumber","type":"string"},"id":{"description":"Identification","title":"Id","type":"string"},"mutationDate":{"default":null,"description":"Mutation date","title":"Mutationdate","type":"string","nullable":true},"name":{"description":"Name of the place","title":"Name","type":"string"},"noted":{"description":"Any information that was stated","title":"Noted","type":"boolean"},"status":{"description":"Status of the place","title":"Status","type":"string"}},"required":["beginDate","documentDate","documentNumber","id","name","noted","status"],"title":"Place","type":"object"}}}}
```

## The SourceHolder object

```json
{"openapi":"3.0.3","info":{"title":"Matrixian API","version":"1.0.0"},"components":{"schemas":{"SourceHolder":{"properties":{"id":{"description":"Id of the source holder","title":"Id","type":"string"},"name":{"description":"Name of the source holder","title":"Name","type":"string"}},"required":["id","name"],"title":"SourceHolder","type":"object"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.matrixian.com/woningdata/bag-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
