<div class="header">
  <div class="container">
    <div class="row">
      <div class="col-xs-4">
        <div class="points"><img alt="An Ideal Postcodes open source project" src="images/github.png" alt="github">
          <h4>Open Source</h4>
          <p>MIT licensed. Maintained and freely available on <a href="https://github.com/ideal-postcodes/postcodes.io">GitHub.</a> Fork it, make a contribution or even set up your own</p>
        </div>
      </div>
      <div class="col-xs-4">
        <div class="points"><img alt="Updated with ONSPD data" src="images/map.png" alt="map">
          <h4>Regularly Updated</h4>
          <p>Updated with the latest data from Ordnance Survey and Office for National Statistics when it becomes available</p>
        </div>
      </div>
      <div class="col-xs-4">
        <div class="points"><img alt="Postcode lookup" src="images/cmd.png" alt="cmd">
          <h4>Convenient Methods</h4>
          <p>Simple, useful and self-explanatory API methods like bulk reverse geocoding, autocomplete and validation</p>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="container">
  <div class="row">
    <div class="col-lg-12">
      <h2 class="api-header">API Endpoint &amp; Methods</h2>
      <div class="api-demo">
        <div class="api-method">
          <h4 class="method-title">Lookup a postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes/<input class="rest-resource" placeholder=":postcode" id="single-postcode-input"><a href="#" id="single-postcode">Request</a></h4><pre class="code-box" id="single-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Bulk lookup postcodes</h4>
          <h4><span class="http-method">POST</span>api.postcodes.io/postcodes<a href="#" id="bulk-postcodes">Request</a></h4>
          <div class="json-post"><textarea id="bulk-postcodes-input">{
  "postcodes" : ["OX49 5NU", "M32 0JG", "NE30 1DP"]
}</textarea></div><pre class="code-box" id="bulk-postcodes-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Get nearest postcodes for a given longitude &amp; latitude</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes?lon=<input class="rest-resource" placeholder=":longitude" id="lon-input">&amp;lat=<input class="rest-resource" placeholder=":latitude" id="lat-input"><a href="#" id="geocode-postcode">Request</a></h4><pre class="code-box" id="geocode-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Bulk Reverse Geocoding</h4>
          <h4><span class="http-method">POST</span>api.postcodes.io/postcodes<a href="#" id="bulk-reverse">Request</a></h4>
          <div class="json-post"><textarea id="bulk-reverse-input">{
  "geolocations" : [{
    "longitude":  0.629834723775309,
    "latitude": 51.7923246977375
  }, {
    "longitude": -2.49690382054704,
    "latitude": 53.5351312861402,
    "radius": 1000,
    "limit": 5
  }]
}</textarea></div><pre class="code-box" id="bulk-reverse-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Get a random postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/random/postcodes<a href="#" id="random-postcode">Request</a></h4><pre class="code-box" id="random-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Validate a postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes/<input class="rest-resource" placeholder=":postcode" id="validate-postcode-input">/validate<a href="#" id="validate-postcode">Request</a></h4><pre class="code-box" id="validate-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Nearest postcodes for postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes/<input class="rest-resource" placeholder=":postcode" id="nearest-postcode-input">/nearest<a href="#" id="nearest-postcode">Request</a></h4><pre class="code-box" id="nearest-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Autocomplete a postcode partial</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes/<input class="rest-resource" placeholder=":postcode" id="autocomplete-postcode-input">/autocomplete<a href="#" id="autocomplete-postcode">Request</a></h4><pre class="code-box" id="autocomplete-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Query for postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/postcodes?q=<input class="rest-resource" placeholder=":postcode" id="query-postcode-input"><a href="#" id="query-postcode">Request</a></h4><pre class="code-box" id="query-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Lookup terminated postcode</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/terminated_postcodes/<input class="rest-resource" placeholder=":postcode" id="single-terminated-postcode-input"><a href="#" id="single-terminated-postcode">Request</a></h4><pre class="code-box" id="single-terminated-postcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Lookup Outward Code</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/outcodes/<input class="rest-resource" placeholder=":outcode" id="show-outcode-input"><a href="#" id="show-outcode">Request</a></h4><pre class="code-box" id="show-outcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Nearest outward code for outward code</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/outcodes/<input class="rest-resource" placeholder=":outcode" id="nearest-outcode-input"><a href="#" id="nearest-outcode">Request</a>/nearest</h4><pre class="code-box" id="nearest-outcode-result"></pre></div>
        <div class="api-method">
          <h4 class="method-title">Get nearest outward codes for a given longitude &amp; latitude</h4>
          <h4><span class="http-method">GET</span>api.postcodes.io/outcodes?lon=<input class="rest-resource" placeholder=":longitude" id="lon-outcode-input">&amp;lat=<input class="rest-resource" placeholder=":latitude" id="lat-outcode-input"><a href="#" id="geocode-outcode">Request</a></h4><pre class="code-box" id="geocode-outcode-result"></pre></div>
      </div>
    </div>
  </div>
</div>
