# Account

{% hint style="success" %}
**Note:** OpenET uses a tiered system for accounts. Results from each of the following endpoints may vary by account. For more information, check out the [quota](https://openet.gitbook.io/docs/additional-resources/quota "mention") section.
{% endhint %}

## Account Status

Retrieve information about your account in a *`JSON`* format. See the [quota](https://openet.gitbook.io/docs/additional-resources/quota "mention") page for additional details. &#x20;

## Upload

> Upload a temporary GeoJSON file to use with OpenET.

```json
{"openapi":"3.1.0","info":{"title":"OpenET API","version":"3.0.0"},"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Body_upload_account_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_account_upload_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/account/upload":{"post":{"tags":["Manage Account Information"],"summary":"Upload","description":"Upload a temporary GeoJSON file to use with OpenET.","operationId":"upload_account_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_account_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

Take a look at how you might call this method:

{% tabs %}
{% tab title="curl" %}
{% code overflow="wrap" %}

```bash
curl -X 'GET' \
  'https://openet-api.org/account/status' \
  -H 'accept: application/json' \
  -H 'Authorization: YOUR_API_KEY' 
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

# set your API key before making the request
header = {"Authorization": YOUR_API_KEY}

# query the api 
resp = requests.get(
    headers=header,
    url="https://openet-api.org/account/status"
)

print(resp.json())
```

{% endtab %}
{% endtabs %}

## Account Storage

If your OpenET account is not synced with your personal Google Earth Engine account, all exported data will be stored in a secure private Google Cloud Bucket. The following endpoint allows you to retrieve downloadable links to these files. This endpoint **must** be called to continue exporting if there are over 100 files which have not been retrieved.&#x20;

Once this endpoint has been called, all existing files will be moved to a **public bucket** with a **24 hour lifecycle**. Data return is in a `JSON` format.&#x20;

{% hint style="warning" %}
**Warning**: exported files will be automatically deleted after **7 days** if not retrieved.&#x20;
{% endhint %}

## Storage

> Retrieves information on all current files exported to OpenET's Google Bucket.

```json
{"openapi":"3.1.0","info":{"title":"OpenET API","version":"3.0.0"},"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/account/storage":{"get":{"tags":["Manage Account Information"],"summary":"Storage","description":"Retrieves information on all current files exported to OpenET's Google Bucket.","operationId":"storage_account_storage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}}}
```

Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="curl" %}

```bash
curl -X 'GET' \
  'https://openet-api.org/account/storage' \
  -H 'accept: application/json' \
  -H 'Authorization: YOUR_API_KEY' 
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# set your API key before making the request
header = {"Authorization": YOUR_API_KEY}

# query the api 
resp = requests.get(
    headers=header,
    url="https://openet-api.org/account/storage"
)

print(resp.json())
```

{% endtab %}
{% endtabs %}

## Upload a File

As an alternative to storing shapefiles on Google Earth Engine, OpenET allows you to generate a temporary asset id by uploading a [RFC 7946](https://geojson.org/) formatted `GeoJSON` file to delineate boundaries for data extractions.&#x20;

Each file uploaded has a maximum file size of **25mb** and expires after **72 hours**. During this time you can use the generated temporary asset id for the corresponding parameter. Data return is in a `JSON` format.&#x20;

## Upload

> Upload a temporary GeoJSON file to use with OpenET.

```json
{"openapi":"3.1.0","info":{"title":"OpenET API","version":"3.0.0"},"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Body_upload_account_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_account_upload_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/account/upload":{"post":{"tags":["Manage Account Information"],"summary":"Upload","description":"Upload a temporary GeoJSON file to use with OpenET.","operationId":"upload_account_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_account_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

Take a look at how you might call this method using *python*, or via *curl*:

{% tabs %}
{% tab title="curl" %}

```bash
curl -X 'POST' \
  'https://openet-api.org/account/upload' \
  -H 'accept: application/json' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@YOUR_FILE.geojson'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# set your API key before making the request
header = {"Authorization": YOUR_API_KEY}

# endpoint arguments
args = {
    'file': ('PATH/TO/sample.geojson', open('PATH/TO/sample.geojson', 'rb'), 'application/geo+json')
}

# query the api 
resp = requests.post(
    headers=header,
    files=args,
    url="https://openet-api.org/account/upload"
)

print(resp.json())
```

{% endtab %}
{% endtabs %}

## Decrypt a File

If you have opted to encrypt a file during an export, the following endpoint allows you to decrypt it. This works for both `.TIFF` rasters and `.CSV` files. Each account has its own unique rotating key so that no user will be able to decrypt another user's files.&#x20;

{% hint style="info" %}
**Note**: OpenET's free account tier does not offer this encryption service. See the [quota](https://openet.gitbook.io/docs/additional-resources/quota "mention") page for more information.&#x20;
{% endhint %}

## Decrypt

> Decrypt an OpenET encrypted file.

```json
{"openapi":"3.1.0","info":{"title":"OpenET API","version":"3.0.0"},"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Body_decrypt_account_decrypt_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_decrypt_account_decrypt_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/account/decrypt":{"post":{"tags":["Manage Account Information"],"summary":"Decrypt","description":"Decrypt an OpenET encrypted file.","operationId":"decrypt_account_decrypt_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_decrypt_account_decrypt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

&#x20;Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="curl" %}

```bash
curl -X 'POST' \
  'https://openet-api.org/account/decrypt' \
  -H 'accept: application/json' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@YOUR_ENCRYPTED_FILE.tif;type=image/tiff'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# set your API key before making the request
header = {"Authorization": YOUR_API_KEY}

# endpoint arguments
args = {
    'file': ('PATH/TO/encrypted.geojson', open('PATH/TO/encrypted.geojson', 'rb'), 'application/geo+json')
}

# query the api 
resp = requests.get(
    headers=header,
    files=args,
    url="https://openet-api.org/account/decrypt"
)

print(resp.json())
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openet.gitbook.io/docs/reference/api-reference/account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
