## Update customer status

### cURL

```bash
curl --request POST \
  --url https://api.fabric.inc/v3/customers/{customerId}/actions/update-status \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "status": "ACTIVE"
}
'
```

### Python

```python
import requests

url = "https://api.fabric.inc/v3/customers/{customerId}/actions/update-status"

payload = { "status": "ACTIVE" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### JavaScript (Fetch)

```javascript
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({status: 'ACTIVE'})
};

fetch('https://api.fabric.inc/v3/customers/{customerId}/actions/update-status', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.fabric.inc/v3/customers/{customerId}/actions/update-status",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "POST",\
  CURLOPT_POSTFIELDS => json_encode([\
    'status' => 'ACTIVE'\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://api.fabric.inc/v3/customers/{customerId}/actions/update-status"

payload := strings.NewReader("{\n  \"status\": \"ACTIVE\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

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

### Java (Unirest)

```java
HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/customers/{customerId}/actions/update-status")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"status\": \"ACTIVE\"\n}")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/customers/{customerId}/actions/update-status")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"status\": \"ACTIVE\"\n}"

response = http.request(request)
puts response.read_body
```

### Response

```json
{
  "type": "CUSTOMER_STATUS_UPDATE_SUCCESS",
  "message": "Customer status updated successfully",
  "status": "ACTIVE"
}
```

### Authorizations

- **Authorization**: string, required in header, bearer token needed.

### Headers

- **x-fabric-tenant-id**: string, required, identifies the tenant.
- **x-fabric-request-id**: string, optional, a UUID for the request.

### Path Parameters

- **customerId**: string, required, 24-char system-generated ID.

### Body

- **status**: enum<string>, required, available options: `ACTIVE`, `INACTIVE`, `BLOCKED`.

### Response

- **type**: string, required, machine-readable code.  
- **message**: string, required, human-readable message.  
- **status**: enum<string>, required, options: `ACTIVE`, `INACTIVE`, `BLOCKED`.
