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

# Endpoints

## **Endpoints**

This section describes all available endpoints in the **METI API v2.0.0**.\
Each endpoint includes authentication requirements, usage details, parameters, and examples.

***

## **Base URL**

All API requests use the following base URL:

```
https://api.millpont.com
```

***

## **Authentication (Required)**

The METI API now uses **Auth0 OAuth2 Client Credentials**.\
You must obtain an access token and include it in every request:

```
Authorization: Bearer <access_token>
```

#### **How to Get a Token**

```bash
curl -X POST "https://<AUTH0_DOMAIN>/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "<YOUR_CLIENT_ID>",
    "client_secret": "<YOUR_CLIENT_SECRET>",
    "audience": "https://api.meti.millpont.com",
    "grant_type": "client_credentials"
  }'
```

#### Example Token Response

```json
{
  "access_token": "eyJhbGc...etc",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "read:sources write:sources delete:sources"
}
```

***

## **Account Isolation**

* Every token contains an `account_id`.
* All queries automatically filter to your account.
* Clients **cannot access** other accounts.
* Admin tokens may access all accounts.

***

## **Endpoints Overview**

| Endpoint               | Method | Description                   |
| ---------------------- | ------ | ----------------------------- |
| `/sources`             | GET    | List sources for your account |
| `/sources`             | POST   | Create one or more sources    |
| `/sources/{source_id}` | GET    | Retrieve a single source      |
| `/sources/{source_id}` | DELETE | Delete a single source        |
| `/sources` (query)     | DELETE | Delete by `alt_id`            |

***

## **GET /sources**

#### **List All Sources (Account-Filtered)**

**URL**

```
GET https://api.millpont.com/sources
```

**Headers**

```
Authorization: Bearer <access_token>
```

**Query Parameters (optional)**

| Parameter                | Type             | Description                                                                    |
| ------------------------ | ---------------- | ------------------------------------------------------------------------------ |
| `methodology`            | string           | Filter by methodology                                                          |
| `limit`                  | integer          | Pagination size                                                                |
| `offset`                 | integer          | Pagination offset                                                              |
| `steward_id`             | string           | ID of producer / grower                                                        |
| `project_id`             | string           | Group sources by project                                                       |
| `outcome_reporting_year` | integer          | The calendar year a source's environmental outcomes are tied to.               |
| `source_type`            | string           | Filter by source type (e.g., `FACILITY`, `FIELD`, `SITE`)                      |
| `attribute_type`         | array of strings | Filter by one or more attribute types (e.g., `CARBON_REMOVAL`, `BIODIVERSITY`) |
| `geometry_source`        | string           | Filter by how the geometry was created (e.g., `CUSTODIAN_DRAWN`, `DERIVED`)    |

#### **Example Request**

```bash
curl -X GET "https://api.millpont.com/sources" \
  -H "Authorization: Bearer <token>"
```

#### **Example Response**

```json
[
  {
[
  {
    "id": "src_abc123",
    "account_id": "8e05e670-65df-4e7e-b2f1-31e0b3094bcf",
    "methodology": "Agriculture",
    "source_type": "FACILITY",
    "attribute_type": ["CARBON_REMOVAL", "BIODIVERSITY"],
    "geometry_source": "CUSTODIAN_DRAWN",
    "country": "United States",
    "hectares": 124.5,
    "geojson": { ... }
  }
]
```

***

## **GET /sources/{source\_id}**

Retrieve a single source by its unique ID.

**URL**

```
GET https://api.millpont.com/sources/{source_id}
```

**Optional Parameters Example**\
\
`GET https://api.millpont.com/sources?steward_id=GM-Producer-1&source_type=FACILITY&attribute_type=CARBON_REMOVAL&attribute_type=BIODIVERSITY`\
\
**Headers**

```
Authorization: Bearer <access_token>
```

**Path Parameter**

| Name        | Type   | Description                           |
| ----------- | ------ | ------------------------------------- |
| `source_id` | string | Source ID (e.g., `src_6ETupIGAbhjb7`) |

#### **Example Request**

```bash
curl -X GET "https://api.millpont.com/sources/src_6ETupIGAbhjb7" \
  -H "Authorization: Bearer <token>"
```

***

## **POST /sources**

#### **Create One or More Sources**

Your request must include:

* A valid **GeoJSON FeatureCollection**
* Each Feature includes:
  * `id`
  * `properties.start_at`
  * `properties.end_at`
  * `geometry` (Polygon or MultiPolygon)
* Optional parameters:
  * `methodology`
  * `tags`
  * `steward_id`
  * `project_id`
  * `outcome_reporting_year`
  * `source_type` : Describes the physical or organizational nature of the source (e.g., `FIELD`, `FACILITY`, `DEVICE`, `PROGRAM`, `JURISDICTIONAL`). Useful for distinguishing point-of-origin contexts within the source ledger.
  * `attribute_type` : An array of one or more environmental attribute classifications associated with the source (e.g., `CARBON_REMOVAL`, `CARBON_AVOIDANCE` ,  `CI_SCORE` , `BIODIVERSITY`, `RENEWABLE_ENERGY` , `WATER_QUALITY` , `WATER_QUANTITY` . Supports multi-attribute sources.
  * `geometry_source` : Indicates how the source geometry was generated (e.g., `CUSTODIAN_DRAWN`, `AUTHORITATIVE_GIS`,  `EXTERNAL_REGISTRY` ). Helps document provenance of spatial boundaries.

Note: Methodology (i.e. "Nature Restoration | Production to Conservation") can provide useful context when overlaps arise in the Source ledger. Tags are used to support additional context. A common use case is to denote the function(s) of the area of interest, for example: "production", "processing", "storage", "transportation".  Steward ID allows you to group sources by producer. Project ID is another way to subgroup your sources. Outcome reporting year is the calendar year environmental outcomes are associated with.

The API automatically attaches:

* `account_id` (from JWT)
* `created_by` and `updated_by` (from JWT metadata)

**URL**

```
POST https://api.millpont.com/sources
```

**Headers**

```
Content-Type: application/json
Authorization: Bearer <access_token>
```

***

#### **Example Request**

```bash
curl -X POST "https://api.millpont.com/sources" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "feature_collection": {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "id": "APITEST2",
          "properties": {
            "start_at": "2024-11-01T16:25:00.000Z",
            "end_at": "2024-11-10T16:25:00.000Z"
          },
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                [-95.9915183, 32.7766954],
                [-95.9915183, 32.7706437],
                [-95.9849752, 32.7706437],
                [-95.9849752, 32.7766954],
                [-95.9915183, 32.7766954]
              ]
            ]
          }
        }
      ]
    },
    "methodology": "Agriculture",
    "source_type": "FACILITY",
    "attribute_type": ["RENEWABLE_ENERGY", "BIODIVERSITY"],
    "geometry_source": "CUSTODIAN_DRAWN",
    "tags": ["test", "api"],
    "steward_id": "GM-Producer-1",
    "project_id": "General Mills",
    "outcome_reporting_year": 2024
  }'
```

#### **Example Response**

```json
[
  {
    "id": "src_6ETupIGAbhjb7",
    "alt_id": "APITEST2",
    "message": "Source created successfully."
  }
]
```

***

## **DELETE /sources/{source\_id}**

Delete a source by its ID.

**URL**

```
DELETE https://api.millpont.com/sources/{source_id}
```

**Headers**

```
Authorization: Bearer <access_token>
```

#### **Example Request**

```bash
curl -X DELETE "https://api.millpont.com/sources/src_tJsijx0UmuGE9" \
  -H "Authorization: Bearer <token>"
```

#### **Example Response**

```json
{
  "message": "Source deleted successfully."
}
```

***

## **DELETE /sources (Delete by alt\_id)**

You may also delete by **alt\_id**:

**URL**

```
DELETE https://api.millpont.com/sources?alt_id=<my_alt_id>
```

**Example**

```bash
curl -X DELETE "https://api.millpont.com/sources?alt_id=APITEST2" \
  -H "Authorization: Bearer <token>"

```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.millpont.com/meti-api-documents/endpoints.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
