Sample code bug in new Actions documentation (Post-User-Registration)

The code sample references:
api.user.setAppMetadata("my-api-user-id", remoteUser.id);

But according the documentation above, the api object is not available for this type of trigger. Which is correct?

A post was split to a new topic: Sample code bug in new Actions documentation(Post-User-Registration)