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

# View a Hook

### Path parameters

<ParamField path="HookId" type="string">
  The unique identifier of the hook.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200">
    <ResponseField name="Url" type="string">
      Max. length: 255 characters

      The URL to which the notification is sent.
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `DISABLED`, `ENABLED`

      Whether the hook is enabled or not.
    </ResponseField>

    <ResponseField name="Validity" type="string">
      **Returned values:** `VALID`, `INVALID`

      Whether the hook is valid or not. Once `INVALID` (following unsuccessful retries) the hook must be disabled and re-enabled.
    </ResponseField>

    <ResponseField name="EventType" type="string">
      **Returned values:** An `EventType` listed in the <a href="/webhooks/event-types">event types list</a>

      The type of the event.
    </ResponseField>

    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="Tag" type="string">
      Max. length: 255 characters

      Custom data that you can add to this object.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200 theme={null}
  {
      "Url": "https://example.com",
      "Status": "ENABLED",
      "Validity": "VALID",
      "EventType": "UBO_DECLARATION_VALIDATION_ASKED",
      "Id": "hook_m_01J6EK16AS02MV3H4AMMXMQWZ1",
      "Tag": "Created using the Mangopay API Postman Collection",
      "CreationDate": 1655991027
  }  
  ```
</ResponseExample>

<RequestExample>
  ```php PHP theme={null}
  <?php 

  require_once 'vendor/autoload.php';

  use MangoPay\MangoPayApi;
  use MangoPay\Libraries\ResponseException as MGPResponseException;
  use MangoPay\Libraries\Exception as MGPException;

  $api = new MangoPayApi();

  $api->Config->ClientId = 'your-client-id';
  $api->Config->ClientPassword = 'your-api-key';
  $api->Config->TemporaryFolder = 'tmp/';

  try {
      $hookId = '198685419';

      $response = $api->Hooks->Get($hookId);

      print_r($response);
  } catch(MGPResponseException $e) {
      print_r($e);
  } catch(MGPException $e) {
      print_r($e);
  }  
  ```

  ```javascript NodeJS   theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk')
  const mangopay = new mangopayInstance({
    clientId: 'your-client-id',
    clientApiKey: 'your-api-key',
  })

  let hook = {
    Id: '144086866',
  }

  const getHook = async (hookId) => {
    return await mangopay.Hooks.get(hookId)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  getHook(hook.Id)  
  ```

  ```ruby Ruby   theme={null}
  require 'mangopay'

  MangoPay.configure do |client|
      client.preproduction = true
      client.client_id = 'your-client-id'
      client.client_apiKey = 'your-api-key'
      client.log_file = File.join(Dir.pwd, 'mangopay.log')
  end

  def viewHook(hookId)
      begin
          response = MangoPay::Hook.fetch(hookId)
          puts response
          return response
      rescue MangoPay::ResponseError => error
          puts "Failed to fetch Hook: #{error.message}"
          puts "Error details: #{error.details}"
          return false
      end
  end

  myHook = {
      Id: '194445815'
  }

  viewHook(myHook[:Id])  
  ```

  ```java Java  theme={null}
  package com.samples.Helpers.Webhooks;

  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.mangopay.MangoPayApi;
  import com.mangopay.entities.Hook;

  public class ViewHook {
      public static void main(String[] args) throws Exception {
          MangoPayApi mangopay = new MangoPayApi();
          mangopay.getConfig().setClientId("your-client-id");
          mangopay.getConfig().setClientPassword("your-api-key");

          var hookId = "hook_m_01J3JQ13F0M5NY83M1GZKVNS95";

          Hook viewHook = mangopay.getHookApi().get(hookId);

          Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
          String prettyJson = prettyPrint.toJson(viewHook);

          System.out.println(prettyJson);   
      }
  }
  ```

  ```python Python   theme={null}
  from pprint import pprint
  import mangopay

  mangopay.client_id='your-client-id'
  mangopay.apikey='your-api-key'

  from mangopay.api import APIRequest
  handler = APIRequest(sandbox=True)

  from mangopay.resources import Notification

  hook_id = 'hook_m_01HR4KJ27QBRPNZG351R3SBA0B'

  try:
      view_hook = Notification.get(hook_id)
      pprint(view_hook._data)
  except Notification.DoesNotExist:
      print('Hook {} does not exist.'.format(hook_id))  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  using Newtonsoft.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          MangoPayApi api = new MangoPayApi();

          api.Config.ClientId = "your-client-id";
          api.Config.ClientPassword = "your-api-key";

          var hookId = "hook_m_01J55XNB6X4A0VJJ8W8CP9V51D";

          var viewHook = await api.Hooks.GetAsync(hookId);

          string prettyPrint = JsonConvert.SerializeObject(viewHook, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
