{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gsma/json-schema/gsma-request-state-object-schema.json",
  "title": "requestStateObject",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gsma-accounts-api-openapi.yml#/components/schemas/requestStateObject",
  "type": "object",
  "required": [
    "notificationMethod",
    "serverCorrelationId",
    "status"
  ],
  "properties": {
    "serverCorrelationId": {
      "type": "string",
      "description": "A unique identifier issued by the provider to enable the client to identify the RequestState resource on subsequent polling requests. Must be supplied as a UUID.",
      "minLength": 1,
      "maxLength": 256,
      "pattern": "^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$"
    },
    "objectReference": {
      "type": "string",
      "description": "Provides a reference to the subject resource, e.g. transaction reference.",
      "minLength": 0,
      "maxLength": 256
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "completed",
        "failed"
      ],
      "description": "Indicates the status of the request."
    },
    "notificationMethod": {
      "type": "string",
      "enum": [
        "callback",
        "polling"
      ],
      "description": "Indicates whether a callback will be issued or whether the client will need to poll."
    },
    "pendingReason": {
      "type": "string",
      "description": "A textual description that can be provided to describe the reason for a pending status.",
      "minLength": 0,
      "maxLength": 256
    },
    "expiryTime": {
      "type": "string",
      "format": "date-time",
      "description": "Indicate the time by which the provider will fail the request if completion criteria have not been met. For an example, a debit party failing to authorise within the allowed period."
    },
    "pollLimit": {
      "type": "number",
      "format": "int32",
      "description": "Indicates the number of poll attempts for the given requeststate resource that will be allowed by the provider.",
      "exclusiveMinimum": 0
    },
    "error": {
      "description": "If the asynchronous processing failed, details of the error will be returned here.",
      "allOf": [
        {
          "$ref": "#/$defs/errorObject"
        }
      ]
    }
  },
  "$defs": {
    "errorObject": {
      "type": "object",
      "required": [
        "errorCategory",
        "errorCode"
      ],
      "properties": {
        "errorCategory": {
          "type": "string",
          "description": "The category grouping for the error.",
          "enum": [
            "businessRule",
            "validation",
            "authorisation",
            "identification",
            "internal",
            "serviceUnavailable"
          ]
        },
        "errorCode": {
          "type": "string",
          "description": "The harmonised error code identifying the reason for error.",
          "enum": [
            "genericError",
            "dailyVolumeLimitExceeded",
            "dailyValueLimitExceeded",
            "weeklyVolumeLimitExceeded",
            "weeklyValueLimitExceeded",
            "monthlyVolumeLimitExceeded",
            "monthlyValueLimitExceeded",
            "accountMaxTotalVolumeExceeded",
            "accountMaxTotalValueExceeded",
            "lessThanTransactionMinValue",
            "greaterThanTransactionMaxValue",
            "maxBalanceExceeded",
            "samePartiesError",
            "duplicateRequest",
            "insufficientFunds",
            "incorrectState",
            "underPaymentNotAllowed",
            "overPaymentNotAllowed",
            "rateLimitError",
            "transactionTypeError",
            "noMandateAuthority",
            "linkViolation",
            "countryofOriginNotPermitted",
            "nationalityNotPermitted",
            "idDocumentNotSupported",
            "issuingCountryNotSupported",
            "quoteHasExpired",
            "identifierError",
            "lengthError",
            "formatError",
            "negativeValue",
            "currencyNotSupported",
            "mandatoryValueNotSupplied",
            "invalidOffset",
            "clientAuthorisationError",
            "requestDeclined",
            "servicingPartyAuthorisationError",
            "requestingPartyAuthorisationError"
          ]
        },
        "errordescription": {
          "type": "string",
          "description": "A textual description of the error.",
          "minLength": 0,
          "maxLength": 256
        },
        "errorDateTime": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp indicating when the error occurred."
        },
        "errorParameters": {
          "description": "Diagnostic information in the form of key/value pairs relating to the error.",
          "allOf": [
            {
              "$ref": "#/$defs/metadataArray"
            }
          ]
        }
      }
    },
    "metadata": {
      "type": "object",
      "required": [
        "key",
        "value"
      ],
      "properties": {
        "key": {
          "type": "string",
          "description": "Identifies the type of additional field.",
          "minLength": 1,
          "maxLength": 256
        },
        "value": {
          "type": "string",
          "description": "Identifies the value of the additional field.",
          "minLength": 1,
          "maxLength": 256
        }
      }
    },
    "metadataArray": {
      "type": "array",
      "description": "A collection of key/value pairs. These can be used to populate additional properties that describe administrative information regarding the resource.",
      "items": {
        "$ref": "#/$defs/metadata"
      },
      "maxItems": 20
    }
  }
}