> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axle.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Collecting and validating addresses

> Market participation starts with an address we can associate to a meter

To participate in a market, we need to know the [MPAN](https://smartmetercheck.citizensadvice.org.uk/meters/new?fuel_type=electricity) of the user's meter. This is the primary identifier that actors within the electricity system use to identify a consumer of electricity.

This page describes how to collect addresses in a way that allows us to retrieve the MPANs associated with them, and
fall back to asking users for their MPAN directly if necessary.

<Note>If you've already collected addresses and would like to retrieve MPANs from them, see [Retrieving meter details](./find-mpan).</Note>

# Recommended workflow

<img src="https://mintcdn.com/fascinating-teal-alpaca/A8R6SAfID51DsTBv/images/address-collection.png?fit=max&auto=format&n=A8R6SAfID51DsTBv&q=85&s=a6cc6350dd319284d538d12c01df8cc1" alt="Address Collection Workflow" width="1278" height="828" data-path="images/address-collection.png" />

1. Collect the user's postcode
2. Use that to retrieve a list of valid addresses for that postcode
3. Present the user with that list of addresses to choose from
4. If the user's address is not in the list, ask them to enter the MPAN directly

# Implementing address collection

<Tabs>
  <Tab title="Via our API">
    1. Use the [search meters](../api-reference/meter/search) endpoint to search by `postcode`. This returns a list of possible matches.
    2. If the user selects an address from the list, you can use the `ref` from that address to retrieve the meter details using the [meter info by ref](../api-reference/meter/get-by-ref) endpoint.
    3. If the user does not find their address in the list, you can ask them to enter their MPAN directly. You can validate this MPAN using the [validate MPAN](../api-reference/validation/mpan) endpoint. Once you've collected a valid MPAN, you can retrieve the meter details using the [meter info by mpan](../api-reference/meter/get-by-mpan) endpoint.
  </Tab>

  <Tab title="Via prebuilt components">
    You can use our address collection component to streamline collection of valid addresses. This will implement the logic
    [described above](#recommended-workflow) and provide a user-friendly interface for your users to select their address.

    <iframe src="https://storybook-prod-530781020708.europe-north1.run.app/iframe.html?globals=&args=&id=forms-address--default&viewMode=story" height="600" frameBorder="0" title="Address Collection Component" style={{"#bg-input": {backgroundColor:'white'}}} className="p-6 rounded-lg shadow-sm border border-theme card-bg bg-white md:mx-8 my-8 text-gray-900 w-xs" />

    For more details see the docs for the [Address Collection Component](../components/components/address).
  </Tab>
</Tabs>
