# Create an organization record with FHIR

> **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 within the Redox organization or your own OID) is the unique identifier for your organization within the Carequality Interoperability Framework. The <u>**organization OID**</u> 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 Carequality 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. 

> **Data model option**
>
> Did you know you can also do this workflow with Redox data models? [Learn how to create an organization record with the Redox Data Model API](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/create-a-carequality-organization-record).

> **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)

## FHIR destination slugs

You must populate any test queries with the appropriate FHIR destination slug for the specific type of request:  

| Query purpose | Destination slug |
| --------------- | ---------- | 
| Query for/create/update/delete an organization | `ceq-orgs` |
| Perform a patient search within a specific organization | `ceq-xcpd:{{OID-FROM-ORGANIZATION-QUERY}}` |
| Search for a clinical summary/document | `ceq-xca:{{OID-FROM-ORGANIZATION-QUERY}}` | 

> **Which OID to use**
>
> The `{{OID-FROM-ORGANIZATION-QUERY}}` is the OID of the Carequality participant you’re querying, not the OID of your Carequality organization.  

## Create your organization record

1. In your development environment, using Postman or `curl`, send an `Organization create` request to create your organization record in Carequality. The `id` property should match the OID provided in the `identifier` array and is required.
 

**FHIR example: Create an organization record**

```bash
curl --request POST \
  --url https://api.redoxengine.com/fhir/R4/ceq-orgs/{{ENVIRONMENT}}/Organization \
  --header 'Content-Type: application/json' \
  --data '{
  "resourceType": "Organization",
  "id": "2.16.840.1.113883.3.6147.458.2",
  "identifier": [
    {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "value": "2.16.840.1.113883.3.6147.458.2"
    }
  ],
  "active": true,
  "type": [
    {
      "coding": [
        {
          "system": "http://hl7.org/fhir/organization-type",
          "code": "Connection"
        }
      ]
    }
  ],
  "name": "Redox Gateway",
  "alias": [
    "Redox"
  ],
  "address": [
    {
      "use": "work",
      "type": "both",
      "line": [
        "25 West Main Street, Suite 500"
      ],
      "city": "Madison",
      "state": "WI",
      "postalCode": "53703",
      "country": "USA"
    }
  ],
  "partOf": {
    "identifier": {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "type": {
        "text": "HCID"
      },
      "value": "2.16.840.1.113883.3.6147.458"
    }
  },
  "contact": [
    {
      "purpose": {
        "text": "Technical"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "carequality@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    },
    {
      "purpose": {
        "text": "Business"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "support@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    }
  ]
}
```




> **API reference**
>
> [Review the `Organization` schema ](https://docs.redoxengine.com/permalink/9387fce6-d4b4-52be-adb2-70f56f73bdf5-create)for more technical details.


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


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

```json
200 OK
```


3. Once you complete testing, repeat these steps for your production environment.

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

## Update your organization record

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. Send an `Organization update` request with the updated organization details. 


**FHIR example: Update an organization record**

```bash
curl --request PUT \
  --url https://api.redoxengine.com/fhir/R4/ceq-orgs/{{ENVIRONMENT}}/Organization/2.16.840.1.113883.3.6147.458.2 \
  --header 'Content-Type: application/json' \
  --data '{
  "resourceType": "Organization",
  "id": "2.16.840.1.113883.3.6147.458.2",
  "identifier": [
    {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "value": "2.16.840.1.113883.3.6147.458.2"
    }
  ],
  "active": true,
  "type": [
    {
      "coding": [
        {
          "system": "http://hl7.org/fhir/organization-type",
          "code": "Connection"
        }
      ]
    }
  ],
  "name": "Redox Gateway",
  "alias": [
    "Redox"
  ],
  "address": [
    {
      "use": "work",
      "type": "both",
      "line": [
        "25 West Main Street, Suite 500"
      ],
      "city": "Madison",
      "state": "WI",
      "postalCode": "53703",
      "country": "USA"
    }
  ],
  "partOf": {
    "identifier": {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "type": {
        "text": "HCID"
      },
      "value": "2.16.840.1.113883.3.6147.458"
    }
  },
  "contact": [
    {
      "purpose": {
        "text": "Technical"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "carequality@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    },
    {
      "purpose": {
        "text": "Business"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "support@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    }
  ]
}
```




> **API reference**
>
> [Review the `Organization update` schema ](https://docs.redoxengine.com/permalink/9387fce6-d4b4-52be-adb2-70f56f73bdf5-update)for more technical details.


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


**FHIR example: Successful response for updating an organization record**

```json
200 OK
```



## Deactivate your organization record

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. Send an `Organization update` request with the `Active` field set to `false` to deactivate the organization record.


> **What deactivating means**
>
> Marking an organization as inactive doesn’t erase all of its information or delete the organization record. It simply notes the facility as inactive.




**FHIR example: Deactivate an organization record**

```bash
curl --request PUT \
  --url https://api.redoxengine.com/fhir/R4/ceq-orgs/{{ENVIRONMENT}}/Organization/2.16.840.1.113883.3.6147.458.2 \
  --header 'Content-Type: application/json' \
  --data '{
  "resourceType": "Organization",
  "id": "2.16.840.1.113883.3.6147.458.2",
  "identifier": [
    {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "value": "2.16.840.1.113883.3.6147.458.2"
    }
  ],
  "active": false,
  "type": [
    {
      "coding": [
        {
          "system": "http://hl7.org/fhir/organization-type",
          "code": "Connection"
        }
      ]
    }
  ],
  "name": "Redox Gateway",
  "alias": [
    "Redox"
  ],
  "address": [
    {
      "use": "work",
      "type": "both",
      "line": [
        "25 West Main Street, Suite 500"
      ],
      "city": "Madison",
      "state": "WI",
      "postalCode": "53703",
      "country": "USA"
    }
  ],
  "partOf": {
    "identifier": {
      "use": "official",
      "system": "http://www.hl7.org/oid/",
      "type": {
        "text": "HCID"
      },
      "value": "2.16.840.1.113883.3.6147.458"
    }
  },
  "contact": [
    {
      "purpose": {
        "text": "Technical"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "carequality@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    },
    {
      "purpose": {
        "text": "Business"
      },
      "name": {
        "use": "official",
        "text": "Redox, Carequality"
      },
      "telecom": [
        {
          "system": "email",
          "value": "support@redoxengine.com",
          "use": "work"
        },
        {
          "system": "phone",
          "value": "+16085359501",
          "use": "work"
        }
      ]
    }
  ]
}
```




> **API reference**
>
> [Review the `Organization update` schema ](https://docs.redoxengine.com/permalink/9387fce6-d4b4-52be-adb2-70f56f73bdf5-update)for more technical details.


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


**FHIR example: Successful response for deactivating an organization record**

```json
200 OK
```



## Next steps

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

> **Resources for onramp to Carequality with FHIR **
>
> **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 an organization record with FHIR](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/create-an-organization-record-with-fhir)
> - [Search for patient records with FHIR](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/search-for-patient-records-with-fhir)
> - [Request patient documents with FHIR](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/request-patient-documents-with-fhir)
> - [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)
