# Create a Carequality organization record

> **Who can use this how-to**
>
> - Existing customers using <u>**Network Onramps**</u> to connect to the <u>**Carequality Interoperability Framework**</u>.
> - Existing customers with a direct connection to the <u>**Carequality Interoperability Framework**</u> (i.e., without Redox).

An <u>**organization record**</u> (i.e., OID in the Redox organization) is the unique identifier for your organization within the Carequality Interoperability Framework. The organization OID is how you identify yourself when searching for patients—and how other Carequality participants can find you and your patients.

You should plan to register at least one organization record per unique master patient index (MPI) or physical location. [Learn more about OIDs and identity](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/carequality-identity-and-organization-structure) to understand why you may want to register more than one organization. 

> **FHIR option**
>
> Did you know you can also do this workflow with Redox FHIR? [Learn how to create an organization record with FHIR](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/create-an-organization-record-with-fhir).

> **Use curl for technical validation**
>
> You can copy our code examples and send the test requests with `curl` ([learn more about curl](https://curl.haxx.se/docs/manpage.html)) instead of Postman. If you do, remember to:
>
> - Replace any variables with your specific data (e.g., your organization's OID) before sending the request. 
>   - `$VARIABLE`: An environment variable you can set in your terminal before running the command.
>   - `{{variable here}}`: A placeholder for your specific data. 
> - Add the `source-id` if you have multiple sources. We don’t include `{{source-id}}` in the code examples, so you’ll have to add them yourself. [Learn about including source details](/basics/data-exchange-with-redox/Managing-source-details-in-outgoing-requests).
> - Make sure you have a full request for your own use since some of the code examples are abbreviated.
>
> Check out these troubleshooting guides if you run into errors:
>
> - [Troubleshoot Carequality errors](/troubleshooting/troubleshoot-carequality-interoperability-framework-errors)
> - [Troubleshoot OAuth API key errors](/troubleshooting/troubleshoot-oauth-api-key-errors)

## Destination IDs

You must populate any test requests with the appropriate destination ID in the `Meta.Destinations` array based on the environment and type of requests:  

| Request purpose | Development ID | Production ID |
| --------------- | ---------- | ------------- |
| Perform a broad patient search | `adf917b5-1496-4241-87e2-ed20434b1fdb` | `97f2dc1d-c71b-43a7-a436-9b789d44c804` |
| Perform a patient search within a specific organization | `1ca254a8-8d42-4593-abb4-b21399d9de57` | `6391b961-55ae-430b-a789-cf575f03fca0` |
| Query for/create/update/delete an organization | `a07afe3b-d247-4415-827f-6837707e1b8b` | `5d0fd248-6c52-4ad9-b907-ae10bf2dcc39` |
| Search for a clinical summary/document | `ec745338-8849-43ad-a7ce-4bc5bf1d8b89` | `628cbf79-1156-4923-b9d0-285906160ed6` |
| Save patient details and documents to your data on demand repository | This is specific to your organization. Redox provides the destination ID for data on demand. | This is specific to your organization. Redox provides the destination ID for data on demand. |

## Create your organization record

1. Using Postman or `curl`, send an `Organization.New` request to create your organization record in Carequality.
   - There are two different destination IDs in this request: 
     - `Meta.Destinations.ID`: The Carequality destination ID from the reference table above. This routes the request to the appropriate destination, or endpoint.
     - `Organizations.DestinationID`: The Redox destination ID where you receive inbound traffic from Carequality via Redox. You can use `null` for testing. 


**Example: Create an organization record in Carequality**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
  "Meta": {
    "DataModel": "Organization",
    "EventType": "New",
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ]
  },
  "Directory": "Carequality",
  "Action": "Create",
  "Organizations": [
    {
      "Name": "My Company",
      "DestinationID": "{{YOUR-REDOX-DESTINATION-ID}}",
      "Aliases": ["My Company, LLC", "MY"],
      "Active": true,
      // OID is the only required identifier, but you can include your own identifiers as needed.
      "Identifiers": [
        {
          "ID": "{{YOUR-ORGANIZATION-OID}}",
          "IDType": "OID"
        }
      ],
      // This references Redox as your top-level, and your other organizations for levels below.
      "PartOf": {
        "Identifier": {
          // Your "PartOf" or parent should be Redox: 2.16.840.1.113883.3.6147.458.2
          "Value": "{{YOUR-BASE-OID}}"
        }
      },
      // Replace this information with your contact information.
      "Contacts": [
        {
          "Purpose": "Technical",
          "Name": "Redox Carequality Support - Test",
          "EmailAddresses": ["support@redoxengine.com"],
          "PhoneNumber": {
            "Work": "+16085359501",
            "Mobile": "+16085359501"
          }
        }
      ],
      // Replace this information with your address information.
      "Address": {
        "StreetAddress": "2020 Eastwood Dr",
        "City": "Madison",
        "State": "WI",
        "ZIP": "53704",
        "County": "Dane",
        "Country": "USA"
      }
    }
  ]
}'
```




> **API reference**
>
> [Review the Organization data model](https://docs.redoxengine.com/permalink/organization-new) schema for more technical details.


2. If the request is successful, you receive a synchronous response indicating that your organization record was created.


**Example: Successful response for creating an organization record**

```json
{
  "Meta": {
    "DataModel": "Organization",
    "EventType": "New",
    "Message": {
      "ID": 4606153124
    },
    "Source": {
      "ID": "7f296bb4-83fd-498d-92f3-a76960648788",
    },
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ],
    "Extensions": {
      "ResponseDetail": {
        "string": "New organization was added successfully."
      }
    }
  }
}
```



If you don't receive the expected response, [review common Carequality errors](/troubleshooting/troubleshoot-carequality-interoperability-framework-errors). 

Once you complete all of your testing, you need to repeat these steps to create your organization record in production, too.

## Update your organization

Whenever there are changes to your organization details (e.g., address or contact information), follow these steps to keep your organization record up-to-date:

1. Using Postman or `curl`, send an `Organization.Update` request with the updated organization details.
   - Set the `EventType` and `Action` fields to `Update`.


**Example: Update a Carequality organization record**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
  "Meta": {
    "DataModel": "Organization",
    "EventType": "Update",
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ]
  },
  "Directory": "Carequality",
  "Action": "Update",
  "Organizations": [
    {
      "Name": "My Company Facility 1 Update",
      "DestinationID": "{{YOUR-REDOX-DESTINATION-ID}}",
      "Active": true,
      "Identifiers": [
        {
          "ID": "{{YOUR-ORGANIZATION-OID}}",
          "IDType": "OID"
        }
      ],
      // This references the top-level Redox organization.
      "PartOf": {
        "Identifier": {
          "Value": "{{YOUR-BASE-OID}}"
        }
      },
      "Contacts": [
        {
          "Purpose": "Technical",
          "Name": "Redox Carequality Support - Test",
          "EmailAddresses": ["support@redoxengine.com"],
          "PhoneNumber": {
            "Work": "+16085359501",
            "Mobile": "+16085359501"
          }
        }
      ],
      "Address": {
        "StreetAddress": "2020 Westwood Drive",
        "City": "Madison",
        "State": "WI",
        "ZIP": "53704",
        "County": "Dane",
        "Country": "USA"
      }
    }
  ]
}'
```




> **API reference**
>
> [Review the Organization data model](https://docs.redoxengine.com/permalink/organization-new) schema for more technical details.


2. If the request is successful, you receive a synchronous response indicating that your organization record was updated.


**Example: Successful response for organization update **

```json
{
  "Meta": {
    "DataModel": "Organization",
    "EventType": "Update",
    "Message": {
      "ID": 4606153124
    },
    "Source": {
      "ID": "7f296bb4-83fd-498d-92f3-a76960648788"
    },
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ],
    "Extensions": {
      "ResponseDetail": {
        "string": "Organization with id:2.16.840.1.113883.3.6147.5 has been updated successfully."
      }
    }
  }
}
```



## Deactivate your organization

You can’t delete or erase a Carequality organization record and its information. However, you can deactivate it if you’re not an active Carequality participant anymore.

1. Using Postman or `curl`, send an `Organization.Update` request with the `Active` field set to `false` to deactivate an organization.


**Example: Deactivate a Carequality organization record**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
  "Meta": {
    "DataModel": "Organization",
    // Everything can stay the same as New except here and the "Action" field below.
    "EventType": "Update",
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ]
  },
  "Directory": "Carequality",
  "Action": "Update",
  "Organizations": [
    {
      "Name": "My Company Facility 1 Update",
      "DestinationID": "{{YOUR-REDOX-DESTINATION-ID}}",
      "Active": false,
      "Identifiers": [
        {
          "ID": "{{YOUR-ORGANIZATION-OID}}",
          "IDType": "OID"
        }
      ],
      // This references the top-level Redox organization.
      "PartOf": {
        "Identifier": {
          "Value": "{{YOUR-BASE-OID}}"
        }
      },
      "Contacts": [
        {
          "Purpose": "Technical",
          "Name": "Redox Carequality Support - Test",
          "EmailAddresses": ["support@redoxengine.com"],
          "PhoneNumber": {
            "Work": "+16085359501",
            "Mobile": "+16085359501"
          }
        }
      ],
      "Address": {
        "StreetAddress": "2020 Eastwood Dr",
        "City": "Madison",
        "State": "WI",
        "ZIP": "53704",
        "County": "Dane",
        "Country": "USA"
      }
    }
  ]
}'
```




> **API reference**
>
> [Review the Organization data model](https://docs.redoxengine.com/permalink/organization-new) schema for more technical details.


2. If the request is successful, you receive a synchronous response indicating that your organization record was updated.


**Example: Successful response for organization update **

```json
{
  "Meta": {
    "DataModel": "Organization",
    "EventType": "Update",
    "Message": {
      "ID": 4606153124
    },
    "Source": {
      "ID": "7f296bb4-83fd-498d-92f3-a76960648788"
    },
    "Destinations": [
      {
        "ID": "a07afe3b-d247-4415-827f-6837707e1b8b"
      }
    ],
    "Extensions": {
      "ResponseDetail": {
        "string": "Organization with id:2.16.840.1.113883.3.6147.5 has been updated successfully."
      }
    }
  }
}
```



## Next steps

- [Search for patient records](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/search-for-patient-records)

> **Onramp to Carequality resources**
>
> **Basic information**
>
> - [Interact with clinical networks](/how-to-use-redox/interact-with-clinical-networks)
> - [Carequality identity and organization structure](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/carequality-identity-and-organization-structure)
> - [Carequality FAQ](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/carequality-interoperability-framework-faq)
> - [Carequality test patients](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/test-sandbox-for-onramp-to-Carequality) (contains patient data to use when testing)
>
> **How-to**
>
> - [Set up your onramp to Carequality](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/set-up-your-onramp-to-carequality)
> - [Create and maintain an organization record](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/create-a-carequality-organization-record)
> - [Search for patient records](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/search-for-patient-records)
> - [Request patient documents](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/request-patient-documents)
> - [Maintain your Redox repository](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/maintain-your-redox-repository-for-carequality)
>
> **Troubleshooting**
>
> - [Common Carequality errors](/troubleshooting/troubleshoot-carequality-interoperability-framework-errors)
