# put\_\_organization\_{orgId}

`PUT /organization/{orgId}`

*Update Organization Details*

Update organization details and settings. This endpoint requires ADMINISTRATOR or OWNER role permissions. Only the fields provided in the request body will be updated. Users can only modify their own organization.

#### TypeScript Client Library

```typescript
// Note: This endpoint doesn't have a direct client method in the provided TypeScript client
// You would need to use the generic makeRequest method:
// this.makeRequest<any>(`organization/${orgId}`, 'PUT', { 
//   name: 'Updated Organization Name',
//   address1: '456 New Business Ave',
//   city: 'Los Angeles',
//   state: 'CA',
//   mfaEnforced: true
// });
```

#### Code Samples

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

```shell
# You can also use wget
curl -X PUT https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000 \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {access-token}' \
  -d '{
    "name": "Updated Organization Name",
    "address1": "456 New Business Ave",
    "city": "Los Angeles",
    "state": "CA",
    "mfaEnforced": true
  }'
```

{% endtab %}

{% tab title="HTTP" %}

```http
PUT https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000 HTTP/1.1
Host: localhost:3000
Accept: application/json
Content-Type: application/json
Authorization: Bearer {access-token}

{
  "name": "Updated Organization Name",
  "address1": "456 New Business Ave",
  "city": "Los Angeles",
  "state": "CA",
  "mfaEnforced": true
}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Content-Type':'application/json',
  'Authorization':'Bearer {access-token}'
};

const body = {
  name: "Updated Organization Name",
  address1: "456 New Business Ave",
  city: "Los Angeles",
  state: "CA",
  mfaEnforced: true
};

fetch('https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000',
{
  method: 'PUT',
  headers: headers,
  body: JSON.stringify(body)
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

body = {
  name: "Updated Organization Name",
  address1: "456 New Business Ave",
  city: "Los Angeles",
  state: "CA",
  mfaEnforced: true
}

result = RestClient.put 'https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000',
  body.to_json, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

body = {
  "name": "Updated Organization Name",
  "address1": "456 New Business Ave",
  "city": "Los Angeles",
  "state": "CA",
  "mfaEnforced": True
}

r = requests.put('https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000', 
                 headers=headers, 
                 data=json.dumps(body))

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$body = array(
    'name' => 'Updated Organization Name',
    'address1' => '456 New Business Ave',
    'city' => 'Los Angeles',
    'state' => 'CA',
    'mfaEnforced' => true
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('PUT','https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000', array(
        'headers' => $headers,
        'json' => $body
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
con.setDoOutput(true);

String jsonInputString = "{\"name\":\"Updated Organization Name\",\"address1\":\"456 New Business Ave\",\"city\":\"Los Angeles\",\"state\":\"CA\",\"mfaEnforced\":true}";

try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonInputString.getBytes("utf-8");
    os.write(input, 0, input.length);
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

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

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    body := map[string]interface{}{
        "name": "Updated Organization Name",
        "address1": "456 New Business Ave",
        "city": "Los Angeles",
        "state": "CA",
        "mfaEnforced": true,
    }

    jsonBody, _ := json.Marshal(body)
    data := bytes.NewBuffer(jsonBody)
    req, err := http.NewRequest("PUT", "https://backend.flashback.tech/organization/123e4567-e89b-12d3-a456-426614174000", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses

> 200 Response

```json
{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Updated Organization Name",
    "domain": "acme.com",
    "address1": "456 New Business Ave",
    "address2": "Suite 100",
    "city": "Los Angeles",
    "zipcode": "10001",
    "phone": "+1-555-0123",
    "state": "CA",
    "country": "US",
    "deletedAt": null,
    "reposDisabled": false,
    "website": "https://acme.com",
    "is_business": true,
    "mfaEnforced": true
  },
  "message": "Organization updated successfully"
}
```

> 400 Response

```json
{
  "success": false,
  "data": null,
  "message": "No valid fields to update"
}
```

> 403 Response

```json
{
  "success": false,
  "data": null,
  "message": "Insufficient permissions: only OWNER and ADMINISTRATOR roles can modify organization"
}
```

> 404 Response

```json
{
  "success": false,
  "data": null,
  "message": "Organization not found"
}
```

> 500 Response

```json
{
  "success": false,
  "data": null,
  "message": "Internal server error"
}
```

#### Path Parameters <a href="#put__organization__orgid-pathparameters" id="put__organization__orgid-pathparameters"></a>

| Name    | Type   | Required | Description                                     |
| ------- | ------ | -------- | ----------------------------------------------- |
| » orgId | string | true     | Unique identifier of the organization to update |

#### Request Body <a href="#put__organization__orgid-requestbody" id="put__organization__orgid-requestbody"></a>

| Name           | Type    | Required | Restrictions | Description                                     |
| -------------- | ------- | -------- | ------------ | ----------------------------------------------- |
| » name         | string  | false    | none         | Organization name                               |
| » address1     | string  | false    | none         | Primary address line                            |
| » address2     | string  | false    | none         | Secondary address line                          |
| » city         | string  | false    | none         | City                                            |
| » zipcode      | string  | false    | none         | ZIP/Postal code                                 |
| » phone        | string  | false    | none         | Phone number                                    |
| » state        | string  | false    | none         | State/Province                                  |
| » country      | string  | false    | none         | Country                                         |
| » is\_business | boolean | false    | none         | Whether this is a business organization         |
| » mfaEnforced  | boolean | false    | none         | Whether multi-factor authentication is enforced |

#### Responses <a href="#put__organization__orgid-responses" id="put__organization__orgid-responses"></a>

| Status | Meaning                                                                    | Description                                          | Schema |
| ------ | -------------------------------------------------------------------------- | ---------------------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Organization updated successfully                    | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | No valid fields to update                            | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7235#section-3.3)               | Insufficient permissions or user not in organization | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | Organization not found                               | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal server error                                | Inline |

#### Response Schema <a href="#put__organization__orgid-responseschema" id="put__organization__orgid-responseschema"></a>

Status Code **200**

| Name             | Type               | Required | Restrictions | Description                                     |
| ---------------- | ------------------ | -------- | ------------ | ----------------------------------------------- |
| » success        | boolean            | false    | none         | Indicates if the request was successful         |
| » data           | object             | false    | none         | Updated organization data                       |
| »» id            | string             | false    | none         | Unique identifier for the organization          |
| »» name          | string             | false    | none         | Organization name                               |
| »» domain        | string             | false    | none         | Organization domain                             |
| »» address1      | string             | false    | none         | Primary address line                            |
| »» address2      | string             | false    | none         | Secondary address line                          |
| »» city          | string             | false    | none         | City                                            |
| »» zipcode       | string             | false    | none         | ZIP/Postal code                                 |
| »» phone         | string             | false    | none         | Phone number                                    |
| »» state         | string             | false    | none         | State/Province                                  |
| »» country       | string             | false    | none         | Country                                         |
| »» deletedAt     | string (date-time) | false    | none         | Deletion timestamp (null if active)             |
| »» reposDisabled | boolean            | false    | none         | Whether repositories are disabled               |
| »» website       | string             | false    | none         | Organization website URL                        |
| »» is\_business  | boolean            | false    | none         | Whether this is a business organization         |
| »» mfaEnforced   | boolean            | false    | none         | Whether multi-factor authentication is enforced |
| » message        | string             | false    | none         | Success message                                 |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description                                   |
| --------- | ------- | -------- | ------------ | --------------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful       |
| » data    | null    | false    | none         | No data returned                              |
| » message | string  | false    | none         | Error message describing the validation issue |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description                                   |
| --------- | ------- | -------- | ------------ | --------------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful       |
| » data    | null    | false    | none         | No data returned                              |
| » message | string  | false    | none         | Error message describing the permission issue |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description                             |
| --------- | ------- | -------- | ------------ | --------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful |
| » data    | null    | false    | none         | No data returned                        |
| » message | string  | false    | none         | Error message describing the issue      |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description                               |
| --------- | ------- | -------- | ------------ | ----------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful   |
| » data    | null    | false    | none         | No data returned                          |
| » message | string  | false    | none         | Error message describing the server issue |

#### Security

* **BearerAuth**: Bearer token authentication required
* **Organization Access**: User must be a member of the specified organization
* **Role Requirements**: Requires ADMINISTRATOR or OWNER role to modify organization settings

#### Notes

* Only the fields provided in the request body will be updated
* Undefined values in the request body are filtered out and not processed
* Users can only modify their own organization's details
* The `domain`, `deletedAt`, `reposDisabled`, and `website` fields cannot be modified through this endpoint
* Organization settings are excluded from both request and response as requested
* At least one valid field must be provided in the request body
