{
  "service": "espocrm",
  "displayName": "EspoCRM",
  "categories": [
    "Productivity",
    "Marketing"
  ],
  "authTypes": [
    "api_key"
  ],
  "auth": [
    {
      "type": "api_key",
      "label": "API Key",
      "placeholder": "API_KEY_COPIED_FROM_THE_USER_DETAIL_VIEW",
      "description": "EspoCRM API key sent with the X-Api-Key request header. Create an API User in Administration > API Users and copy the API key from that user's detail view: https://docs.espocrm.com/development/api/",
      "extraFields": [
        {
          "key": "baseUrl",
          "label": "Site URL",
          "inputType": "text",
          "required": true,
          "secret": false,
          "placeholder": "https://crm.example.com",
          "description": "Site URL of your EspoCRM instance, the same URL you open in the browser to use EspoCRM."
        }
      ]
    }
  ],
  "homepageUrl": "https://www.espocrm.com/",
  "actions": [
    {
      "id": "espocrm.create_record",
      "service": "espocrm",
      "name": "create_record",
      "description": "Create one EspoCRM record for the specified entity type.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM entity type, such as Account or Contact."
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "description": "One EspoCRM record field value."
            },
            "description": "The EspoCRM record fields to create or update."
          }
        },
        "additionalProperties": false,
        "description": "The input payload for creating one EspoCRM record."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "record": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "An arbitrary JSON object returned by EspoCRM."
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM record output payload."
      }
    },
    {
      "id": "espocrm.delete_record",
      "service": "espocrm",
      "name": "delete_record",
      "description": "Delete one EspoCRM record by entity type and record identifier.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM entity type, such as Account or Contact."
          },
          "recordId": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM record identifier."
          }
        },
        "additionalProperties": false,
        "description": "The input payload for deleting one EspoCRM record."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "Whether EspoCRM confirmed the record deletion."
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM delete record output payload."
      }
    },
    {
      "id": "espocrm.get_app_user",
      "service": "espocrm",
      "name": "get_app_user",
      "description": "Get the current EspoCRM user data for the configured connection, including ACL and preferences when returned.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "The input payload for this action."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The EspoCRM user identifier."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The EspoCRM user's display name."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "userName": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The EspoCRM login username."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The EspoCRM user type."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "emailAddress": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The user's primary email address."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isActive": {
                "type": "boolean",
                "description": "Whether the EspoCRM user is active."
              }
            },
            "additionalProperties": true,
            "description": "The current EspoCRM user."
          },
          "acl": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "The user's access-control payload when returned."
          },
          "preferences": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "The user's preference payload when returned."
          }
        },
        "additionalProperties": false,
        "required": [
          "user"
        ],
        "description": "The current EspoCRM app user payload."
      }
    },
    {
      "id": "espocrm.get_metadata",
      "service": "espocrm",
      "name": "get_metadata",
      "description": "Get EspoCRM application metadata, optionally narrowed to one metadata path.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "description": "Optional metadata path to return, such as entityDefs.Lead.fields.status.options."
          }
        },
        "additionalProperties": false,
        "description": "The input payload for reading EspoCRM metadata."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "metadata": {
            "description": "The EspoCRM metadata payload returned by the server."
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM metadata output payload."
      }
    },
    {
      "id": "espocrm.get_record",
      "service": "espocrm",
      "name": "get_record",
      "description": "Get one EspoCRM record by entity type and record identifier.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM entity type, such as Account or Contact."
          },
          "recordId": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM record identifier."
          }
        },
        "additionalProperties": false,
        "description": "The input payload for reading one EspoCRM record."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "record": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "An arbitrary JSON object returned by EspoCRM."
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM record output payload."
      }
    },
    {
      "id": "espocrm.list_records",
      "service": "espocrm",
      "name": "list_records",
      "description": "List EspoCRM records for an entity type with optional pagination, sorting, and where clauses.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM entity type, such as Account or Contact."
          },
          "maxSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "description": "The maximum number of records to return."
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "description": "The zero-based list offset."
          },
          "orderBy": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM field used for sorting."
          },
          "order": {
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ],
            "description": "The sort direction."
          },
          "where": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The EspoCRM where clause type."
                },
                "attribute": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The EspoCRM field name used by this where clause."
                },
                "value": {
                  "description": "The comparison value for this where clause."
                }
              },
              "additionalProperties": true,
              "required": [
                "type"
              ],
              "description": "One EspoCRM where clause item."
            },
            "description": "EspoCRM where clauses passed as JSON.",
            "minItems": 1
          }
        },
        "additionalProperties": false,
        "required": [
          "entityType"
        ],
        "description": "The input payload for listing EspoCRM records."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": true,
              "description": "An arbitrary JSON object returned by EspoCRM."
            },
            "description": "The EspoCRM records returned by the list request."
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -2,
                "description": "The total number of records reported by EspoCRM, -1/-2 sentinel values, or null."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM list records output payload."
      }
    },
    {
      "id": "espocrm.update_record",
      "service": "espocrm",
      "name": "update_record",
      "description": "Update selected fields on one EspoCRM record.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM entity type, such as Account or Contact."
          },
          "recordId": {
            "type": "string",
            "minLength": 1,
            "description": "The EspoCRM record identifier."
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "description": "One EspoCRM record field value."
            },
            "description": "The EspoCRM record fields to create or update."
          }
        },
        "additionalProperties": false,
        "description": "The input payload for updating one EspoCRM record."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "record": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "An arbitrary JSON object returned by EspoCRM."
          }
        },
        "additionalProperties": false,
        "description": "The EspoCRM record output payload."
      }
    }
  ]
}
