> ## 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.

# Token.update

The `update` method creates or updates a `Token` object.

To create a `Token` object, initialize the object, set the values for its data members, and then call the `update` method to store the changes in the Vindicia database. Do not set a value for `VID`; Subscribe automatically generates a VID when you call `update`. When updating an existing `Token` object, identify it with either its VID or your token ID (`merchantTokenId`).

## 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.

*token*: the `Token` object to create or update. To update an existing `Token` object, identify it with either its VID or your token ID (`merchantTokenId`). If you specify a new value for `merchantTokenId`, Subscribe will create a new Token type.

## Output

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

*token*: the updated or created `Token` object.

## Returns

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

| Return Code | Return String |
| - | - |
| `400` | `Unable to save token:`*error-description.* |
| `501` | `*Error-description*.` (Returned if the call cannot map the SOAP `Token` object to Subscribe’s database representation of the token.) |

## Example

```

$soapCaller = new Token();

$tok = new Token();
$tok->setMerchantTokenId("ANY_TIME_PHONE_MINUTES");
$tok->setDescription("Any time phone minutes for 2010");

// Make the SOAP call to create the token
$response = $tok->update();
if($response['returnCode'] == 200) {
   print "Created token type with id " . 
          $tok->merchantTokenId . " and vid ";
   print $response['token']->VID . "\n";
}
```

**Parent topic:**[Token Methods](../topics/Token_Methods)


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