{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/intely/main/json-schema/intely-app-schema.json",
  "title": "App",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/intely-api-openapi.yml#/components/schemas/App",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string"
    },
    "organizationId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "category": {
      "type": "string",
      "enum": [
        "EMR",
        "Communications",
        "Miscellaneous"
      ]
    },
    "image": {
      "type": "string"
    },
    "homepageUrl": {
      "type": "string",
      "description": "The URL to your application homepage."
    },
    "isEnabled": {
      "type": "boolean",
      "default": false
    },
    "isPublic": {
      "type": "boolean",
      "default": false
    },
    "isStandard": {
      "type": "boolean",
      "default": true
    },
    "interfaces": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "isEnabled": {
            "type": "boolean"
          },
          "className": {
            "type": "string",
            "description": "Only returned for apps owned by the requesting organization."
          },
          "baseUrl": {
            "type": "string"
          },
          "tokenUrl": {
            "type": "string"
          },
          "oauth": {
            "type": "object",
            "properties": {
              "authorizationUrl": {
                "type": "string"
              },
              "scopes": {
                "type": "string"
              },
              "clientId": {
                "type": "string",
                "description": "The client id provided to Intely for your application"
              },
              "clientSecret": {
                "type": "string",
                "description": "The client secret provided to Intely for your application. Only returned for apps owned by the requesting organization, unless the interface's `refresh_token` consent URL requires it (`authorizationUrl` set and `authorizationOptions.includeClientSecret` true), in which case it is returned to all readers."
              }
            },
            "required": [
              "authorizationUrl",
              "scopes",
              "clientId"
            ]
          },
          "programFields": {
            "type": "array",
            "description": "Only returned for apps owned by the requesting organization, and only when requested with `programFields=1`.",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ]
            }
          },
          "rateLimit": {
            "type": "object",
            "properties": {
              "numberOfCalls": {
                "type": "integer"
              },
              "duration": {
                "type": "integer"
              },
              "durationUnits": {
                "type": "string",
                "enum": [
                  "seconds",
                  "minutes",
                  "hours",
                  "days"
                ]
              }
            },
            "required": [
              "numberOfCalls",
              "duration",
              "durationUnits"
            ]
          },
          "authorizationMethod": {
            "type": "object",
            "description": "The authorization method to use when calling the resources.",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "basic",
                  "apiKey",
                  "bearer"
                ]
              },
              "apiKeyInfo": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string",
                    "enum": [
                      "header",
                      "query"
                    ]
                  }
                },
                "required": [
                  "name",
                  "location"
                ]
              }
            },
            "required": [
              "method"
            ]
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "isEnabled": {
                  "type": "boolean"
                },
                "actions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "isEnabled": {
                        "type": "boolean"
                      },
                      "path": {
                        "type": "string"
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "GET",
                          "POST",
                          "PUT",
                          "PATCH",
                          "DELETE"
                        ]
                      },
                      "requireAuthorization": {
                        "type": "boolean"
                      },
                      "parameters": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "description": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "header",
                                "path",
                                "query"
                              ]
                            },
                            "dataType": {
                              "type": "string",
                              "enum": [
                                "string",
                                "encrypted-string",
                                "date-string",
                                "number",
                                "boolean",
                                "json"
                              ]
                            }
                          },
                          "required": [
                            "name",
                            "displayName",
                            "type",
                            "dataType"
                          ]
                        }
                      },
                      "requestBody": {
                        "type": "object",
                        "properties": {
                          "contentType": {
                            "type": "string"
                          },
                          "schema": {
                            "type": "string",
                            "description": "The Rosetta data type id that defines the request body schema."
                          }
                        }
                      },
                      "constraints": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "requirement": {
                              "type": "string",
                              "enum": [
                                "oneOf",
                                "allOf"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "parameter",
                                "body"
                              ]
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "requirements",
                            "type",
                            "fields"
                          ]
                        }
                      },
                      "responses": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "statusCode": {
                              "type": "integer"
                            },
                            "description": {
                              "type": "string"
                            },
                            "responseBodySchema": {
                              "type": "object",
                              "description": "The Rosetta data type id that defines the response body schema."
                            }
                          },
                          "required": [
                            "statusCode"
                          ]
                        }
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "createdBy": {
                        "type": "string"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updatedBy": {
                        "type": "string"
                      },
                      "deletedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "deletedBy": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id",
                      "name",
                      "requireAuthorization",
                      "responses",
                      "createdAt",
                      "createdBy",
                      "updatedAt",
                      "updatedBy"
                    ]
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdBy": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedBy": {
                  "type": "string"
                },
                "deletedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "deletedBy": {
                  "type": "string"
                }
              },
              "required": [
                "_id",
                "name",
                "isEnabled",
                "createdAt",
                "createdBy",
                "updatedAt",
                "updatedBy"
              ]
            }
          },
          "instanceFields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "displayName": {
                  "type": "string"
                },
                "inputType": {
                  "type": "string",
                  "enum": [
                    "string",
                    "encrypted-string",
                    "select",
                    "number",
                    "json",
                    "rosettaMappingId",
                    "timeZone"
                  ]
                },
                "inputTypeSelectOptions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "value",
                      "text"
                    ]
                  }
                },
                "required": {
                  "type": "boolean"
                },
                "mappingType": {
                  "type": "string",
                  "enum": [
                    "authApiKey",
                    "authBasicUsername",
                    "authBasicPassword",
                    "bearerToken",
                    "baseUrl",
                    "tokenUrl",
                    "authorizationUrl",
                    "resource",
                    "program"
                  ]
                },
                "resourceMappings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "resourceId": {
                        "type": "string"
                      },
                      "actionId": {
                        "type": "string"
                      },
                      "fieldType": {
                        "type": "string",
                        "enum": [
                          "parameter",
                          "requestBody"
                        ]
                      },
                      "field": {
                        "type": "string",
                        "description": "The name of the parameter or the property in the request body."
                      }
                    },
                    "required": [
                      "resourceId",
                      "actionId",
                      "fieldType",
                      "field"
                    ]
                  }
                },
                "display": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdBy": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedBy": {
                  "type": "string"
                },
                "deletedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "deletedBy": {
                  "type": "string"
                }
              },
              "required": [
                "_id",
                "name",
                "displayName",
                "inputType",
                "required",
                "mappingType",
                "display",
                "createdAt",
                "createdBy",
                "updatedAt",
                "updatedBy"
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedBy": {
            "type": "string"
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deletedBy": {
            "type": "string"
          }
        },
        "required": [
          "_id",
          "name",
          "isEnabled",
          "resources",
          "createdAt",
          "createdBy",
          "updatedAt",
          "updatedBy"
        ]
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedBy": {
      "type": "string"
    },
    "deletedAt": {
      "type": "string",
      "format": "date-time"
    },
    "deletedBy": {
      "type": "string"
    }
  },
  "required": [
    "_id",
    "organizationId",
    "name",
    "category",
    "isEnabled",
    "isPublic",
    "type",
    "interfaces",
    "createdAt",
    "createdBy",
    "updatedAt",
    "updatedBy"
  ]
}