# Get rebilling config for an app subscription and usage plans

GET https://services.leadconnectorhq.com/marketplace/app/{appId}/rebilling-config/location/{locationId}

Get rebilling config for an app subscription and usage plans for the authenticated sub-account. This endpoint returns the subscription and usage plans for an app.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token only (Private Integration Tokens are not accepted).** Scopes: `oauth.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `appId` | string | Yes | ID of the app to get rebilling config |
| `locationId` | string | Yes | ID of the Sub-Account location to get rebilling config for |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/marketplace/app/{appId}/rebilling-config/location/{locationId}": {
      "get": {
        "summary": "Get rebilling config for an app subscription and usage plans",
        "operationId": "getRebillingConfigForAnAppSubscriptionAndUsagePlans",
        "description": "Get rebilling config for an app subscription and usage plans for the authenticated sub-account. This endpoint returns the subscription and usage plans for an app.",
        "parameters": [
          {
            "name": "appId",
            "required": true,
            "in": "path",
            "description": "ID of the app to get rebilling config",
            "schema": {
              "example": "6578278e879ad2646715ba9c",
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "ID of the Sub-Account location to get rebilling config for",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved rebilling config for the app",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetRebillingConfigResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Invalid request parameters or missing required data."
          },
          "403": {
            "description": "Forbidden. The client does not have necessary permissions to access installer details."
          }
        },
        "security": [
          {
            "Location-Access-Only": [
              "oauth.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetRebillingConfigResponseDTO": {
        "type": "object",
        "properties": {
          "plans": {
            "description": "The rebilling plans configuration",
            "example": {
              "subscription": [
                {
                  "resellingAmount": 0,
                  "baseAmount": 999,
                  "planId": "5ae000000000000000000000",
                  "features": [
                    "feature1",
                    "feature2"
                  ],
                  "paymentType": "month",
                  "name": "Monthly Plan - 999",
                  "paymentTime": "month"
                }
              ],
              "usage": [
                {
                  "productType": "workflow_action",
                  "productName": "Send Group iMessage",
                  "usageUnit": "action / message",
                  "meterId": "680b97022b4a34420f5f9b93",
                  "meterName": "Send Group iMessage",
                  "fixedPricePerUnit": 0.01001,
                  "priceType": "fixed",
                  "minPricePerUnit": "0.01001",
                  "maxPricePerUnit": "0.01001",
                  "executionLimitPerCycle": 1000
                }
              ]
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "subscription": {
                    "description": "Subscription plans",
                    "example": [
                      {
                        "resellingAmount": 0,
                        "baseAmount": 999,
                        "planId": "5ae000000000000000000000",
                        "features": [
                          "feature1",
                          "feature2"
                        ],
                        "paymentType": "month",
                        "name": "Monthly Plan - 999",
                        "paymentTime": "month"
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "resellingAmount": {
                          "type": "number",
                          "description": "The reselling amount",
                          "example": 0
                        },
                        "baseAmount": {
                          "type": "number",
                          "description": "The base amount",
                          "example": 0
                        },
                        "planId": {
                          "type": "string",
                          "description": "The plan id",
                          "example": "5ae000000000000000000000"
                        },
                        "features": {
                          "description": "The features",
                          "example": [
                            "feature1",
                            "feature2"
                          ],
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "paymentType": {
                          "type": "string",
                          "description": "The payment time",
                          "example": "month"
                        },
                        "name": {
                          "type": "string",
                          "description": "The plan name",
                          "example": "Monthly Plan - 999"
                        },
                        "paymentTime": {
                          "type": "string",
                          "description": "The payment time",
                          "example": "month"
                        }
                      },
                      "required": [
                        "resellingAmount",
                        "baseAmount",
                        "planId",
                        "features",
                        "paymentType",
                        "name",
                        "paymentTime"
                      ],
                      "title": "SubscriptionPlanDTO"
                    }
                  },
                  "usage": {
                    "description": "Usage-based plans",
                    "example": [
                      {
                        "productType": "workflow_action",
                        "productName": "Send Group iMessage",
                        "usageUnit": "action / message",
                        "meterId": "680b97022b4a34420f5f9b93",
                        "meterName": "Send Group iMessage",
                        "fixedPricePerUnit": 0.01001,
                        "priceType": "fixed",
                        "minPricePerUnit": "0.01001",
                        "maxPricePerUnit": "0.01001",
                        "executionLimitPerCycle": 1000
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "productType": {
                          "type": "string",
                          "description": "The product type",
                          "example": "workflow_action"
                        },
                        "productName": {
                          "type": "string",
                          "description": "The product name",
                          "example": "Send Group iMessage"
                        },
                        "usageUnit": {
                          "type": "string",
                          "description": "The usage unit for the meter",
                          "example": "action / message"
                        },
                        "meterId": {
                          "type": "string",
                          "description": "The meter id",
                          "example": "680b97022b4a34420f5f9b93"
                        },
                        "meterName": {
                          "type": "string",
                          "description": "The meter name",
                          "example": "Send Group iMessage"
                        },
                        "fixedPricePerUnit": {
                          "type": "number",
                          "description": "The fixed price per unit, applicable for fixed price type",
                          "example": 0.01001
                        },
                        "priceType": {
                          "type": "string",
                          "description": "The price type",
                          "example": "fixed",
                          "enum": [
                            "fixed",
                            "dynamic"
                          ]
                        },
                        "minPricePerUnit": {
                          "type": "string",
                          "description": "The min price per unit, applicable for dynamic price type",
                          "example": "0.01001"
                        },
                        "maxPricePerUnit": {
                          "type": "string",
                          "description": "The max price per unit, applicable for dynamic price type",
                          "example": "0.01001"
                        },
                        "executionLimitPerCycle": {
                          "type": "number",
                          "description": "The execution limit per cycle",
                          "example": 1000
                        }
                      },
                      "required": [
                        "productType",
                        "productName",
                        "usageUnit",
                        "meterId",
                        "meterName",
                        "fixedPricePerUnit",
                        "priceType",
                        "minPricePerUnit",
                        "maxPricePerUnit",
                        "executionLimitPerCycle"
                      ],
                      "title": "UsagePlanDTO"
                    }
                  }
                },
                "required": [
                  "subscription",
                  "usage"
                ],
                "title": "PlansDTO"
              }
            ]
          }
        },
        "required": [
          "plans"
        ],
        "title": "GetRebillingConfigResponseDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/marketplace/app/{appId}/rebilling-config/location/{locationId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/marketplace/app/<appId>/rebilling-config/location/<locationId>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
