> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Entitlement.fetchByEntitlementIdAndAccount

The behavior and use of the `fetchByEntitlementIdAndAccount` call are similar to the `fetchByAccount()` call. The only exception is that, instead of retrieving all the `Entitlement` objects for a specific customer, this method enables you to retrieve an `Entitlement` object with a specific entitlement ID for that customer. For details on how to interpret and store fetched `Entitlement` objects, see the [Entitlement.fetchByAccount](Entitlement_fetchByAccou) method.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*entitlementId*: your entitlement ID (`merchantEntitlementId`), which serves as one of the two search criteria.

*account*: the `Account` object, which serves as one of the two search criteria. Use the `merchantAccountId` or `VID` to identify the object.

*showAll*: a Boolean flag, which, if `true`, shows all entitlements, including those that have expired. if `false` or `null`, returns only active entitlements.

*includeChildren*: an optional Boolean flag that, if set to `true`, includes any children associated with this `Account`. If this flag is omitted, Subscribe will interpret it as `false`, and constructs the query without looking at any child's account.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*entitlement*: the `Entitlement` object with the specified entitlement ID (`merchantEntitlementId`) for the specified `Account` object.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | `Account not specified.` |
| `404` | `Account not found.` |

## Example

```

$account = new Account();

$account->setMerchantAccountId('xyz101');
// create the entitlement object to make the SOAP call
$entitlement = new Entitlement();
$entitlement_id = 'ent_id_to_search_by';

// fetch the record
$response = 
   $entitlement->fetchByEntitlementIdAndAccount($entitlement_id, $account);
if ($response['returnCode'] == 200) {
   $ent = $response['data']->entitlement;
   if ($ent != null) {
      $customer_id = $ent->getAccount()->getMerchantAccountId();
      $entitlement_id= $ent->getMerchantEntitlementId();      
      $active = $ent->getActive();
      if ($active) {
         $active_till = $ent->getEndTimestamp();
      }
   // use or locally store info obtained above
   }
}
```

**Parent topic:**[Entitlement Methods](../topics/Entitlement_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.