---
title: "Result of fetch request for a consent artefact"
method: POST
path: "/v0.5/consents/on-fetch"
tags: ["consent flow", "cm facing"]
---

# Result of fetch request for a consent artefact

`POST /v0.5/consents/on-fetch`

Must contain either consentDetail or error. Possible reason of errors are 
1. consentId passed through /fetch is invalid

## Headers

- `Authorization` string, required
- `X-HIU-ID` string, required

## Request body

- ConsentArtefactResponse
  - `consent` object
    - `consentDetail` object, required
      - `careContexts` object[], required
        - `careContextReference` string, required
        - `patientReference` string, required
      - `consentId` string, uuid, required
      - `consentManager` object, required
        - `id` string, required
      - `createdAt` string, date-time, required
      - `hiTypes` HITypeEnum[], required
      - `hip` object, required
        - `id` string, required
      - `hiu` object, required
        - `id` string, required
      - `patient` ConsentManagerPatientID, required
        - `id` string, <user-id>@ndhm
      - `permission` Permission, required
        - `accessMode` 'VIEW' | 'STORE' | 'QUERY' | 'STREAM', required
        - `dataEraseAt` string, date-time, required
        - `dateRange` object, required
          - `from` string, date-time
          - `to` string, date-time
        - `frequency` object, required
          - `repeats` integer
          - `unit` 'HOUR' | 'WEEK' | 'DAY' | 'MONTH' | 'YEAR'
          - `value` integer
      - `purpose` UsePurpose, required
        - `code` string, required — From the fixed set, documented at refUri
        - `refUri` string, uri
        - `text` string, required
      - `requester` Requester
        - `identifier` object
          - `system` string
          - `type` string
          - `value` string
        - `name` string, required
      - `schemaVersion` string, string
    - `signature` string, required
    - `status` 'GRANTED' | 'EXPIRED' | 'DENIED' | 'REQUESTED' | 'REVOKED', required
  - `error` Error
    - `code` 1000 | 10001
    - `message` string
  - `requestId` string, uuid, required — a nonce, unique for each HTTP request
  - `resp` RequestReference, required
    - `requestId` string, uuid, required — the requestId that was passed
  - `timestamp` string, date-time, required — Date time format in UTC, includes miliseconds YYYY-MM-DDThh:mm:ss.vZ

## Response `202`

Request Accepted

## Other responses

- `400` — **Causes:** * Invalid data sent
- `401` — **Causes:** * Expired/Invalid token.
- `500` — **Causes:** * Downstream system(s) is down. * Unhandled exceptions.

---

[API](https://skmtc.net/ndhm/apis/ndhm-gateway.md) · [All operations](https://skmtc.net/ndhm/apis/ndhm-gateway/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ndhm/ndhm-gateway/revisions/a440e2981b29/schema)
