Answers.Body: <p>I have never seen the checksum available in the API.</p>
  
  <p>I have successfully obtained it programmatically though with code similar to:</p>
  
  <pre><code>$cs = CRM_Contact_BAO_Contact_Utils::generateChecksum($contact_id);
  </code></pre>
  
  <p>(This snippet is adapted from core code in CRM/Utils/Token.php)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-12T20:50:39.103Z
Answers.Text: thanks for the lead.  Unfortunately, my application is only able communicate via REST and doesn't have access to the core Civi application.  Still, this lets me know that it is possible, if it isn't already apart of the REST spec.
Answers.UserDisplayName: mac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T20:44:29.560Z
Answers.Text: This would be incredibly useful via API.  If a checksum is not currently available in the API, then has anyone explored what it would take to program this?  If it is worth building and contributing to the community, or doing an MIH for it.
Answers.UserDisplayName: Daniel Ando Scholnick
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-12T20:45:38.443Z
Answers.LastActivityDate: 2015-08-12T20:45:38.443Z
Answers.UserDisplayName: DaveD
Answers.Body: <p>I'm pretty certain you can't get a checksum from the standard API.  However, you should write (or commission) an extension to provide a checksum API.  The API would basically be a wrapper around the code that DaveD suggested, and you can <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-AddanAPIfunction">read documentation here</a> on how to use Civix to generate an API in your extension.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T22:00:25.890Z
Answers.Text: Or it could be added as an action in the contact api. E.g. `civicrm_api3('Contact', 'generatechecksum', array('id' => $cid));` and it might also be nice to have `civicrm_api3('Contact', 'validatechecksum', array('id' => $cid, 'checksum' => 'abc123'));`
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T13:30:33.180Z
Answers.LastActivityDate: 2015-08-17T13:30:33.180Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>I needed this exact functionality, so I wrote the extension that provides it, <a href="https://github.com/MegaphoneJon/com.megaphonetech.checksums" rel="noreferrer">com.megaphonetech.checksums</a>.  I used Coleman's comment above as my spec :)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T16:02:33.713Z
Answers.Text: Nice one Jon :)
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-08T17:56:06.623Z
Answers.LastActivityDate: 2019-02-08T17:56:06.623Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Now with API4 there is <code>\Civi\Api4\Contact::getChecksum()</code> and <code>\Civi\Api4\Contact::validateChecksum()</code> available.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-04T18:57:37.660Z
Answers.LastActivityDate: 2022-08-04T18:57:37.660Z
Answers.UserDisplayName: herb
Body: <p>Is there a way to view or generate a Contact's checksum via the REST API?  </p>
  
  <p>I'm looking to use the checksum to provide relevant form links, etc., but need to get it programmatically on a Contact basis.  Any and all insight is appreciated. Thanks!</p>
  
Tags: <api><contacts><rest><checksum>
Title: Get or generate a contact checksum via API?
ThreadText: # Get or generate a contact checksum via API?
  
  (Asked by: username_0 on 2015-08-12)
  
  Is there a way to view or generate a Contact's checksum via the REST API?
  
  I'm looking to use the checksum to provide relevant form links, etc., but need to get it programmatically on a Contact basis. Any and all insight is appreciated. Thanks!
  
  **Tags:** api, contacts, rest, checksum
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2015-08-12. Score: 11 | Accepted answer
  
  I have never seen the checksum available in the API.
  I have successfully obtained it programmatically though with code similar to:
  $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum($contact_id);
  
  (This snippet is adapted from core code in CRM/Utils/Token.php)
  
  > **Comments:**
  > **username_0**: thanks for the lead.  Unfortunately, my application is only able communicate via REST and doesn't have access to the core Civi application.  Still, this lets me know that it is possible, if it isn't already apart of the REST spec.  
  > **username_2**: This would be incredibly useful via API.  If a checksum is not currently available in the API, then has anyone explored what it would take to program this?  If it is worth building and contributing to the community, or doing an MIH for it.  
  
  ---
  
  ### Answer by username_3 on 2015-08-17. Score: 9
  
  I'm pretty certain you can't get a checksum from the standard API. However, you should write (or commission) an extension to provide a checksum API. The API would basically be a wrapper around the code that username_1 suggested, and you can [read documentation here](http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-AddanAPIfunction) on how to use Civix to generate an API in your extension.
  
  > **Comments:**
  > **username_4**: Or it could be added as an action in the contact api. E.g. `civicrm_api3('Contact', 'generatechecksum', array('id' => $cid));` and it might also be nice to have `civicrm_api3('Contact', 'validatechecksum', array('id' => $cid, 'checksum' => 'abc123'));`  
  
  ---
  
  ### Answer by username_5 on 2019-02-08. Score: 5
  
  I needed this exact functionality, so I wrote the extension that provides it, [com.megaphonetech.checksums](https://github.com/MegaphoneJon/com.megaphonetech.checksums). I used username_4's comment above as my spec :)
  
  > **Comments:**
  > **username_4**: Nice one Jon :)  
  
  ---
  
  ### Answer by username_6 on 2022-08-04. Score: 1
  
  Now with API4 there is `\Civi\Api4\Contact::getChecksum()` and `\Civi\Api4\Contact::validateChecksum()` available.
  
  
  ---
  
  