# Retrieve an omnichannel subscription

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Retrieves an `omnichannel_subscription` by its Chargebee `id`.

You can obtain the ID from:

-   A successful [record a purchase](/docs/api/recorded_purchases/record-a-purchase) response (`linked_omnichannel_subscriptions`)
-   The [list omnichannel subscriptions](/docs/api/omnichannel_subscriptions/list-omnichannel-subscriptions) API
-   Omnichannel webhook events such as `omnichannel_subscription_created`

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/omnichannel_subscriptions/__test__os_AHsdfs123ld1 \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = OmnichannelSubscription.Retrieve("__test__os_AHsdfs123ld1").Request();

OmnichannelSubscription omnichannelSubscription = result.OmnichannelSubscription;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    omnichannelsubscriptionAction "github.com/chargebee/chargebee-go/v3/actions/omnichannelsubscription"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := omnichannelsubscriptionAction.Retrieve("__test__os_AHsdfs123ld1").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        OmnichannelSubscription := res.OmnichannelSubscription
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.OmnichannelSubscriptionRetrieveRequest{
    Id : "__test__os_AHsdfs123ld1",
}
  res, err := client.OmnichannelSubscription.Retrieve(req)
      if err != nil {
        fmt.Println(err)
    } else {
        OmnichannelSubscription := res.OmnichannelSubscription
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = OmnichannelSubscription.retrieve("__test__os_AHsdfs123ld1").request();

        OmnichannelSubscription omnichannelSubscription = result.omnichannelSubscription();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.omnichannelSubscription.OmnichannelSubscription;
import com.chargebee.v4.models.omnichannelSubscription.params.OmnichannelSubscriptionRetrieveParams;
import com.chargebee.v4.models.omnichannelSubscription.responses.OmnichannelSubscriptionRetrieveResponse;

public class OmnichannelSubscriptionRetrieve {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        OmnichannelSubscriptionRetrieveResponse response = client.omnichannelSubscriptions().retrieve("__test__os_AHsdfs123ld1");

        OmnichannelSubscription omnichannelSubscription = response.getOmnichannelSubscription();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.omnichannelSubscription.retrieve("__test__os_AHsdfs123ld1");

    console.log(result);
    const omnichannelSubscription = result.omnichannel_subscription;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->omnichannelSubscription()->retrieve("__test__os_AHsdfs123ld1");
$omnichannelSubscription = $result->omnichannel_subscription;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.OmnichannelSubscription.retrieve("__test__os_AHsdfs123ld1")
omnichannel_subscription = response.omnichannel_subscription
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::OmnichannelSubscription.retrieve("__test__os_AHsdfs123ld1")

omnichannel_subscription = result.omnichannel_subscription
```

## Sample Response

```json
{
  "omnichannel_subscription": {
    "id": "__test__os_AHsdfs123ld1",
    "app_id": "__test__gps_sdfwerzx5134",
    "customer_id": "__test__XpbTXGTSRp3gEsD8",
    "id_at_source": "20000006743",
    "source": "google_play_store",
    "created_at": 1517487053,
    "object": "omnichannel_subscription",
    "omnichannel_subscription_items": [
      {
        "id": "__test__osi_BXswds133lf1",
        "id_at_source": "com.example.landmarks.premium",
        "status": "active",
        "current_term_start": 1728988425,
        "current_term_end": 1731666825,
        "omnichannel_subscription_item_offers": [
          {
            "id": "__test__off__AHsdfs123LD1",
            "offer_id_at_source": "intro_offer_google_monthly",
            "category": "introductory",
            "category_at_source": "INTRODUCTORY",
            "type": "free_trial",
            "type_at_source": "FREE_TRIAL",
            "discount_type": "percentage",
            "duration": "P1M",
            "percentage": 50,
            "price_currency": "USD",
            "price_units": 2,
            "price_nanos": 90000000,
            "offer_term_start": 1752676649,
            "offer_term_end": 1755268649
          },
          {..}
        ]
      },
      {..}
    ]
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/omnichannel_subscriptions/{omnichannel-subscription-id}

## Returns

- `omnichannel_subscription` (Omnichannel subscription object)
  Resource object representing Omnichannel subscription
