Uninstalling Applications

There are situations where an application wants to remove old installations from the system. In cases where user intervention is not required, you can send a request to Shopify API to cause an Application to be removed from a Shop.

Uninstalling an application is an irreversible operation. Be entirely sure that you no longer need to make API calls for the shop in which the application has been installed.

Uninstalling an application also performs various cleanup tasks within Shopify. Registered Webhooks, ScriptTags and App Links will be destroyed as part of this operation. Also if an application is uninstalled during key rotation, both the old and new Access Tokens will be rendered useless.

Example Implementations

Ruby

The following shows a basic example implementation of API Access revocation


require 'rest_client'
require 'json'

access_token = 'secret'
revoke_url   = 'https://someshop.myshopify.com/admin/api_permissions/current.json'

headers = {
  'X-Shopify-Access-Token' => access_token,
  content_type: 'application/json',
  accept: 'application/json'
}

response = RestClient.delete(revoke_url, headers)
response.code # 200 for success

PHP

The following shows a basic example implementation of API Access revocation


<?php
  $access_token = "secret";
  $revoke_url   = "https://someshop.myshopify.com/admin/api_permissions/current.json"

  $headers = array(
    "Content-Type: application/json",
    "Accept: application/json",
    "Content-Length: 0",
    "X-Shopify-Access-Token: " . $access_token
  );

  $handler = curl_init($revoke_url);
  curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "DELETE");
  curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($handler, CURLOPT_HTTPHEADER, $headers);

  curl_exec($handler);
  if(!curl_errno($handler))
  {
    $info = curl_getinfo($handler);
    // $info['http_code'] == 200 for success
  }

  curl_close($handler);
?>