Getting Started

Sign Up for a Varda Account

  • Visit account.varda.ag
  • Click on the 'Sign Up' link.
  • Create an account, verify your email and login.

Register a new application

  • Go to account.varda.ag/client-apps/all
  • Click "Create application".
  • Provide a friendly name for your application.
  • Select "GFID API Standard access" API.
  • Agree with Terms and Conditions.
  • Click "Create".
  • Click "Generate token".
  • Copy token to your clipboard and save it in a text editor.

Search for fields

  • Open your text editor and paste this curl command:

    curl --location '<https://api.varda.ag/fid/v1/field-searches'>   
      --header 'Content-Type: application/json'   
      --header 'Authorization: Bearer <<${apiKey}>>'
      --data '{  
          "type": "Point",  
          "coordinates": [  
              0.0,  
              51.0  
          ]  
      }'
    
  • Edit the command putting your token in Authorization: Bearer line.

  • Open your terminal and execute the command.

  • Response should be:

    {  
        "entries": [  
            {  
                "field_id": "15RS.5DY6",  
                "boundary_id": "095c1758-21d5-4483-af22-b91275f34b9d"  
            }  
        ]  
    }
    
  • This means that at coordinates (0.0, 51.0) we have found field 15RS.5DY6

Getting the field geometry

  • We can use GET /fields/{id}/boundaries endpoint to get what we need
  • Using the same token, command is now:
    curl 'https://api.varda.ag/fid/v1/fields/15RS.5DY6/boundaries' \
      --header 'Authorization: Bearer <<${apiKey}>>'
    
  • Response should be:
    {
      "type": "FeatureCollection",
      "features": [
        {
          "id": "095c1758-21d5-4483-af22-b91275f34b9d",
          "type": "Feature",
          "geometry": {
            "type": "MultiPolygon",
            "coordinates": [ ... ]
          },
          "bbox": [-0.003052138267072, 50.99796590664352, 0.00025251552533, 51.00059568422394],
          "properties": {
            "centroid": [-0.0012641603628042, 50.99925763755134],
            "representative_point": [-0.0011361547378737, 50.999251888168416],
            "area": {
              "value": 43252.165568,
              "unit": "m2"
            },
            "perimeter": {
              "value": 843.852401,
              "unit": "m"
            },
            "country_iso_codes": ["GBR"],
            "effective_from": "2022-12-04T06:10:30.568+00:00",
            "effective_to": "9999-12-31T00:00:00.000+00:00",
            "boundary_references": [
              {
                "varda:user_provided_key": "1641280_30UYB_gb_202012",
                "varda:boundary_id": "095c1758-21d5-4483-af22-b91275f34b9d",
                "varda:source_name": "GBR-DIGIFARM",
                "varda:delineation_type": "SATELLITE-GENERATED",
                "varda:view_policy": [],
                "id": "c4244153-71fa-45d7-be4c-0ea71a44a561"
              }
            ]
          }
        }
      ]
    }  
    
  • A GeoJSON FeatureCollection with geometry coordinates and metadata is returned.

Python example

Getting a temporary token (needs to be renewed according to expiration time)

import requests

token_url = "<https://auth.varda.ag/oauth/token">  
client_id = "..."  
client_secret = "..."
payload = {  
    "client_id": client_id,  
    "client_secret": client_secret,  
    "audience": "<https://api.varda.ag/fid/">,  
    "grant_type": "client_credentials",  
}  
headers = {  
    "Content-Type": "application/json",  
}
response = requests.request("POST", token_url, headers=headers, json=payload)
access_token = response.json()["access_token"]

Searching for fields

field_searches_url = "https://api.varda.ag/fid/v1/field-searches"
payload = {"type": "Point", "coordinates": [0.0, 51.0]}
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {access_token}",
}

response = requests.request("POST", field_searches_url, headers=headers, json=payload)
gfid = response.json()["entries"][0]["field_id"]

Getting the field geometry

field_boundaries_url = f"https://api.varda.ag/fid/v1/fields/{gfid}/boundaries"
headers = {
    "Authorization": f"Bearer {access_token}",
}
response = requests.request("GET", field_boundaries_url, headers=headers)
print(response.json())