# Account setup and API keys

**N.B** Your credentials will initially only work for sandbox environment. Production credentials will not be sent until later.

### Two Scenarios

#### 1. Existing Terra Customer

* Use existing testing credentials to configure webhook endpoint

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

```javascript
curl --location --request PATCH \
  'https://diagnostics-sandbox.tryterra.co/api/v1/clients/webhook-url' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Basic <YOUR_CLIENT_ID:YOUR_CLIENT_SECRET_BASE64>'
  --data '{
    "webhook_url": "https://your-domain.com/webhooks/terra"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://diagnostics-sandbox.tryterra.co/api/v1/clients/webhook-url"

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Basic <YOUR_CLIENT_ID:YOUR_CLIENT_SECRET_BASE64>'
}

data = {
    "webhook_url": "https://your-domain.com/webhooks/terra"
}

response = requests.patch(url, headers=headers, json=data)

print(response.text)
print(response.status_code)
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://diagnostics-sandbox.tryterra.co/api/v1/clients/webhook-url"

	payload := map[string]string{
		"webhook_url": "https://your-domain.com/webhooks/terra",
	}
	jsonData, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}

	client := &http.Client{}
	req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(jsonData))
	if err != nil {
		panic(err)
	}

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Basic <YOUR_CLIENT_ID:YOUR_CLIENT_SECRET_BASE64>")

	res, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	body, err := io.ReadAll(res.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

* Start ordering!

#### 2. New Customer

* Contact <curtis@tryterra.co>
* Provide necessary information (payment details etc.)&#x20;
* Provide endpoint to receive webhooks
* Receive credentials&#x20;
* Start ordering!!


---

# 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://docs.tryterra.co/vantage-api-docs/account-setup-and-api-keys.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.
