Interactive

API Sandbox Guide

The Agdir Satellite API includes an interactive GraphQL sandbox where you can explore the schema, write queries, and test mutations — all from your browser, with no setup required.

Open the sandbox: satellite.agdir.farm/graphql

What is the API Sandbox?

The sandbox is an Apollo Studio Explorer embedded directly into the API endpoint. It gives you a fully interactive environment to:

  • Browse all available queries, mutations, and types
  • Build queries using point-and-click or by writing GraphQL directly
  • Execute requests and inspect responses in real time
  • View the full schema documentation inline

Accessing the Sandbox

Navigate to the GraphQL endpoint in your browser:

URL
https://satellite.agdir.farm/graphql

The sandbox loads automatically. If it shows an offline message, make sure you have an active internet connection and that JavaScript is enabled in your browser.

Setting Up Authentication

Most operations require an API token. To authenticate in the sandbox:

  1. Click the Headers tab at the bottom of the Operation panel.
  2. Add a new header with the key Authorization.
  3. Set the value to Bearer YOUR_API_TOKEN.
Header configuration
{ "Authorization": "Bearer YOUR_API_TOKEN" }

Need a token? Contact support@agdir.no to request API access credentials.

Exploring the Schema

The sandbox includes a built-in Schema Explorer on the left panel. Use it to:

  • Browse root types — See all available Query and Mutation fields.
  • Inspect fields — Click any field to view its arguments, return types, and descriptions.
  • Search — Use the search bar to quickly find specific operations like processPlantHealth or retrieveVegetationIndices.
  • Build queries visually — Click the + button next to any field to add it to your operation builder automatically.

Running Your First Query

Try this simple query to verify your connection and token. Paste it into the Operation panel and click the play button:

Test query — list your polygons
query { retrievePolygons { Status Message Result { polygonId label hectares } } }

If authenticated correctly, you will see a list of your registered polygons in the Response panel on the right.

Testing a Mutation

Mutations trigger actions — like registering a polygon or starting an analysis. Here is an example that processes a plant health analysis:

Process plant health
mutation { processPlantHealth( polygonId: "YOUR_POLYGON_ID" startDate: "2025-06-01" endDate: "2025-08-31" ) { IsSuccess Status Message Result { requestId } } }

The response includes a requestId that you can use with retrieveRequestDetails() to monitor progress.

Using Variables

For reusable queries, use GraphQL variables instead of inline values. In the sandbox, click the Variables tab at the bottom and add a JSON object:

Operation with variables
mutation ProcessHealth($polygonId: String!, $start: String!, $end: String!) { processPlantHealth( polygonId: $polygonId startDate: $start endDate: $end ) { IsSuccess Status Result { requestId } } }
Variables panel
{ "polygonId": "abc-123", "start": "2025-06-01", "end": "2025-08-31" }

Inspecting Responses

The Response panel shows the full JSON result. Key things to look for:

  • IsSuccesstrue if the operation succeeded.
  • Status — HTTP-style status code (200, 404, etc.).
  • Message — Human-readable description of the result.
  • Result — The data payload, which varies by operation.

For retrieval queries, the Result object contains S3 URLs for PNG, GeoTIFF, and JSON files that you can download directly.

Common Sandbox Workflows

1. Register a field and run your first analysis

  1. Use generatePolygon() to register your field boundaries.
  2. Copy the returned polygonId.
  3. Call processPlantHealth() with that polygon ID and a date range.
  4. Use retrieveRequestDetails() with the returned requestId to monitor progress.
  5. Once status is Success, call retrievePlantHealth() to get the results.

2. Check satellite data availability

  1. Call retrieveSatelliteDownload() with your polygon ID and date range.
  2. Review amountOfAvailableDates vs amountOfCloudDetectedDates to understand data coverage.

3. Explore all available analyses

  1. Open the Schema Explorer in the left panel.
  2. Expand the Mutation type to see all process* operations.
  3. Expand the Query type to see all retrieve* operations.

Troubleshooting

IssueSolution
Sandbox shows "offline" Check your internet connection and refresh the page. The Apollo sandbox requires an external connection to load.
401 Unauthorized Your token is missing or invalid. Check the Authorization header is set correctly with the Bearer prefix.
400 Bad Request Your GraphQL syntax has errors. Check for missing brackets, incorrect field names, or wrong argument types.
No data returned The polygon may not have data for the requested date range. Use retrieveSatelliteDownload() to check availability first.
CORS errors in browser console The sandbox is served from the same origin as the API, so CORS should not be an issue. If you see CORS errors, try clearing your browser cache or disabling browser extensions.

Ready to integrate? Once you have tested your queries in the sandbox, head to the Getting Started guide to learn how to make the same calls from your own code.