# 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!!
