---
title: Retrieve customer's latest product plan
slug: reference/retrieve-customers-latest-product-plan
docTags: 
createdAt: 2025-03-18T18:28:02.918Z
---

{
  "id": "lBBFZYe0uv8ZcW8xRrbzo",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/customer-pricing",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/customer-pricing"
      }
    ],
    "name": "Retrieve customer's latest product plan",
    "description": "<p>Retrieves the latest product plan assigned to a customer. This may not be the currently active plan,\nbut rather the most recently assigned future plan.</p>\n<p>Use this endpoint to:</p>\n<ul>\n<li>Check the latest assigned product plan for billing calculations</li>\n<li>Verify upcoming plan changes before they become active</li>\n<li>Support customer service inquiries about plan assignments</li>\n</ul>\n<p>Use the <a>list</a> endpoint to get the complete plan history of a customer.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "CustomerId",
          "type": "string",
          "example": "customer_12345",
          "description": "Unique identifier for the customer whose latest product plan should be retrieved.\nThis parameter is required unless RelationId is provided.\n"
        },
        {
          "kind": "optional",
          "name": "RelationId",
          "type": "string",
          "example": "relation_67890",
          "description": "<p>Serialized relationship identifier that contains both customer and product information.\nIf provided, this parameter takes precedence over CustomerId and ProductId parameters.\nUsed for direct plan lookups when the relationship context is known.</p>"
        },
        {
          "kind": "optional",
          "name": "ProductId",
          "type": "string",
          "example": "product_abc123",
          "description": "<p>Unique identifier for the specific product within the customer's pricing plan.\nIf not provided, defaults to the account's default product ID.\nUsed to filter plans for a specific product or service.</p>"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Returns the customer's latest product plan with pricing configuration and assignment details",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Assignment of a specific product plan to a customer for a defined time period, establishing pricing rules for billing.",
            "customType": "payment.pricing.customer.CustomerProductPlan.in",
            "schema": [
              {
                "name": "productId",
                "kind": "optional",
                "type": "string",
                "description": "Identifier of the product for which this plan assignment applies.",
                "example": ""
              },
              {
                "name": "productPlanId",
                "kind": "optional",
                "type": "string",
                "description": "Unique identifier of the specific pricing plan assigned to the customer.",
                "example": ""
              },
              {
                "name": "customerId",
                "kind": "optional",
                "type": "string",
                "description": "Unique identifier of the customer who has this product plan assignment.",
                "example": ""
              },
              {
                "name": "startTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Unix timestamp when this product plan assignment becomes active, must be at least one hour before end time.",
                "example": 0
              },
              {
                "name": "endTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Optional unix timestamp when this product plan assignment expires, allowing plan transitions over time.",
                "example": 0
              },
              {
                "name": "relationId",
                "kind": "optional",
                "type": "string",
                "description": "Unique base64-encoded identifier for customer-product plan relationship, computed automatically for external system integration.",
                "example": ""
              },
              {
                "name": "createdTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Unix timestamp when this product plan assignment was originally created, automatically set during creation.",
                "example": 0
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.customer.CustomerProductPlan.in",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid customer ID, relation ID, or malformed request parameters",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Authentication required or invalid API key provided",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Insufficient permissions to access customer pricing information",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Customer not found or no product plan assigned",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal server error occurred while retrieving customer pricing plan",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "bRQKWvGlZh_yNOhGVPi6q",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://app.amberflo.io/payments/pricing/amberflo/customer-pricing?CustomerId=customer_12345' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "A8WQsqEgn32ryJHt2GKrX",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/payments/pricing/amberflo/customer-pricing?CustomerId=customer_12345\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "2YaCRV2ZOGMFRz2QKG5gJ",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/pricing/amberflo/customer-pricing?CustomerId=customer_12345\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "vuBOupLc2ACIpoVfFCNIn",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/pricing/amberflo/customer-pricing?CustomerId=customer_12345\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "bRQKWvGlZh_yNOhGVPi6q"
    },
    "results": {
      "languages": [
        {
          "id": "VGGMv3e3uPuqnCRr5eEgH",
          "language": "200",
          "code": "// Returns the customer's latest product plan with pricing configuration and assignment details\n{\n  \"productId\": \"\",\n  \"productPlanId\": \"\",\n  \"customerId\": \"\",\n  \"startTimeInSeconds\": \"\",\n  \"endTimeInSeconds\": \"\",\n  \"relationId\": \"\",\n  \"createdTimeInSeconds\": \"\"\n}"
        },
        {
          "id": "-KeFOqAxZQCMOmpe775II",
          "language": "400",
          "code": "// Invalid customer ID, relation ID, or malformed request parameters\n"
        },
        {
          "id": "ZUGmqKZjSv5NKQbrTOrHO",
          "language": "401",
          "code": "// Authentication required or invalid API key provided\n"
        },
        {
          "id": "KeOWIeXmO2YC17B95j1ZE",
          "language": "403",
          "code": "// Insufficient permissions to access customer pricing information\n"
        },
        {
          "id": "m5Ck-8E0vmrWbKLz-1voQ",
          "language": "404",
          "code": "// Customer not found or no product plan assigned\n"
        },
        {
          "id": "9SIWGx7vYO0OLLTu8ZPo8",
          "language": "500",
          "code": "// Internal server error occurred while retrieving customer pricing plan\n"
        }
      ],
      "selectedLanguageId": "VGGMv3e3uPuqnCRr5eEgH"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}