## Create Credit Reason

### cURL

```
curl --request POST \
  --url https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '\n{\n  "name": "<string>",\n  "version": 123,\n  "code": "code",\n  "archived": true\n}\n'\n```

### Python

```
import requests

url = "https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons"

payload = {\n    "name": "<string>",\n    "version": 123,\n    "code": "code",\n    "archived": True\n}
headers = {\n    "Authorization": "Bearer <token>",\n    "Content-Type": "application/json"\n}\n
response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### JavaScript

```
const options = {\n  method: 'POST',\n  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},\n  body: JSON.stringify({name: '<string>', version: 123, code: 'code', archived: true})\n};
\nfetch('https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons', options)\n  .then(res => res.json())\n  .then(res => console.log(res))\n  .catch(err => console.error(err));
```

### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons",\
  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([\
    'name' => '<string>',\
    'version' => 123,\
    'code' => 'code',\
    'archived' => true\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json"\
  ],\
]);

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

curl_close($curl);

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

### Go

```
package main

import (\n\t"fmt"\n\t"strings"\n\t"net/http"\n\t"io"\n)

func main() {

\turl := "https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons"

\tpayload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"version\": 123,\n  \"code\": \"code\",\n  \"archived\": true\n}")

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

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

\tres, _ := http.DefaultClient.Do(req)

\tdefer res.Body.Close()
\tbody, _ := io.ReadAll(res.Body)

\tfmt.Println(string(body))
}
```

### Unirest (Java)

```
HttpResponse<String> response = Unirest.post("https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons")\n  .header("Authorization", "Bearer <token>")\n  .header("Content-Type", "application/json")\n  .body("{\n  \"name\": \"<string>\",\n  \"version\": 123,\n  \"code\": \"code\",\n  \"archived\": true\n}")\n  .asString();
```

### Ruby

```
require 'uri'\nrequire 'net/http'\n
url = URI("https://api.m3ter.com/organizations/{orgId}/picklists/creditreasons")\n
http = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n
request = Net::HTTP::Post.new(url)\nrequest["Authorization"] = 'Bearer <token>'\nrequest["Content-Type"] = 'application/json'\nrequest.body = "{\n  \"name\": \"<string>\",\n  \"version\": 123,\n  \"code\": \"code\",\n  \"archived\": true\n}"\n
response = http.request(request)\nputs response.read_body\n```

### Response Structure

#### Success Response (200)
```json
{
  "id": "<string>",
  "version": 123,
  "code": "<string>",
  "name": "<string>",
  "archived": true,
  "dtCreated": "2023-11-07T05:31:56Z",
  "dtLastModified": "2023-11-07T05:31:56Z",
  "createdBy": "<string>",
  "lastModifiedBy": "<string>"
}
```

#### Error Responses (4XX, 5XX)
```json
{
  "message": "<string>"
}
```

### Authorization

* **Authorization**: string (required) – m3ter supports machine to machine authentication using the `clientCredentials` OAuth2 flow.

### Body Parameters
- `name`: string (required) – The name of the entity. Required string length: `1 - 200`
- `version`: integer (required) – The version number of the entity.
- `code`: string – The short code for the entity.
- `archived`: boolean (required) – A Boolean TRUE / FALSE flag indicating whether the entity is archived.
