{
  "service": "plain",
  "displayName": "Plain",
  "categories": [
    "Communication",
    "Productivity"
  ],
  "authTypes": [
    "api_key"
  ],
  "auth": [
    {
      "type": "api_key",
      "label": "API Key",
      "placeholder": "plainApiKey_xxx",
      "description": "Plain machine-user API key sent as a Bearer token. Create it in Settings > Machine Users > Add API Key, or see https://www.plain.com/docs/graphql/authentication."
    }
  ],
  "homepageUrl": "https://www.plain.com",
  "actions": [
    {
      "id": "plain.get_customer_by_email",
      "service": "plain",
      "name": "get_customer_by_email",
      "description": "Fetch one Plain customer by exact email address.",
      "requiredScopes": [],
      "providerPermissions": [
        "customer:read"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "The exact customer email address to look up in Plain.",
            "format": "email"
          }
        },
        "additionalProperties": false,
        "required": [
          "email"
        ],
        "description": "Action input."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "description": "The Plain customer ID."
              },
              "externalId": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Your own external identifier stored on the customer."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fullName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's full name."
              },
              "shortName": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's optional short name."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "description": "The customer's primary email address.",
                "format": "email"
              },
              "emailVerified": {
                "type": "boolean",
                "description": "Whether the customer's primary email address is verified."
              },
              "avatarUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's avatar URL when Plain has one."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "description": "The customer's creation timestamp.",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "description": "The customer's update timestamp.",
                "format": "date-time"
              }
            },
            "additionalProperties": false,
            "required": [
              "id",
              "externalId",
              "fullName",
              "shortName",
              "email",
              "emailVerified",
              "avatarUrl",
              "createdAt",
              "updatedAt"
            ],
            "description": "Action output."
          }
        },
        "additionalProperties": false,
        "required": [
          "customer"
        ],
        "description": "Action output."
      }
    },
    {
      "id": "plain.get_customer_by_external_id",
      "service": "plain",
      "name": "get_customer_by_external_id",
      "description": "Fetch one Plain customer by exact external ID.",
      "requiredScopes": [],
      "providerPermissions": [
        "customer:read"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": "string",
            "minLength": 1,
            "description": "The exact external ID to look up in Plain."
          }
        },
        "additionalProperties": false,
        "required": [
          "externalId"
        ],
        "description": "Action input."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "description": "The Plain customer ID."
              },
              "externalId": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Your own external identifier stored on the customer."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fullName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's full name."
              },
              "shortName": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's optional short name."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "description": "The customer's primary email address.",
                "format": "email"
              },
              "emailVerified": {
                "type": "boolean",
                "description": "Whether the customer's primary email address is verified."
              },
              "avatarUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's avatar URL when Plain has one."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "description": "The customer's creation timestamp.",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "description": "The customer's update timestamp.",
                "format": "date-time"
              }
            },
            "additionalProperties": false,
            "required": [
              "id",
              "externalId",
              "fullName",
              "shortName",
              "email",
              "emailVerified",
              "avatarUrl",
              "createdAt",
              "updatedAt"
            ],
            "description": "Action output."
          }
        },
        "additionalProperties": false,
        "required": [
          "customer"
        ],
        "description": "Action output."
      }
    },
    {
      "id": "plain.search_customers",
      "service": "plain",
      "name": "search_customers",
      "description": "Search Plain customers with one human-oriented term across full name, short name, email, and external ID.",
      "requiredScopes": [],
      "providerPermissions": [
        "customer:read"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "term": {
            "type": "string",
            "minLength": 1,
            "description": "The human search term to match against Plain customers."
          },
          "first": {
            "type": "integer",
            "minimum": 1,
            "description": "The number of customers to return from the first page."
          },
          "after": {
            "type": "string",
            "minLength": 1,
            "description": "The cursor to continue after when fetching the next page."
          }
        },
        "additionalProperties": false,
        "required": [
          "term"
        ],
        "description": "Action input."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "customers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The Plain customer ID."
                },
                "externalId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Your own external identifier stored on the customer."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "fullName": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The customer's full name."
                },
                "shortName": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "The customer's optional short name."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "type": "string",
                  "description": "The customer's primary email address.",
                  "format": "email"
                },
                "emailVerified": {
                  "type": "boolean",
                  "description": "Whether the customer's primary email address is verified."
                },
                "avatarUrl": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "The customer's avatar URL when Plain has one."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "description": "The customer's creation timestamp.",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "The customer's update timestamp.",
                  "format": "date-time"
                }
              },
              "additionalProperties": false,
              "required": [
                "id",
                "externalId",
                "fullName",
                "shortName",
                "email",
                "emailVerified",
                "avatarUrl",
                "createdAt",
                "updatedAt"
              ],
              "description": "Action output."
            },
            "description": "The matching Plain customers."
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "hasNextPage": {
                "type": "boolean",
                "description": "Whether another page exists after this one."
              },
              "hasPreviousPage": {
                "type": "boolean",
                "description": "Whether a previous page exists before this one."
              },
              "startCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The start cursor for the current page."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "endCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The end cursor for the current page."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "hasNextPage",
              "hasPreviousPage",
              "startCursor",
              "endCursor"
            ],
            "description": "Action output."
          }
        },
        "additionalProperties": false,
        "required": [
          "customers",
          "pageInfo"
        ],
        "description": "Action output."
      }
    },
    {
      "id": "plain.upsert_customer",
      "service": "plain",
      "name": "upsert_customer",
      "description": "Create or update one Plain customer using exactly one identifier plus create and update payloads.",
      "requiredScopes": [],
      "providerPermissions": [
        "customer:create",
        "customer:edit"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "object",
            "properties": {
              "emailAddress": {
                "type": "string",
                "description": "The customer's email address in Plain.",
                "format": "email"
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "Your own stable external identifier for the customer."
              },
              "customerId": {
                "type": "string",
                "minLength": 1,
                "description": "The Plain customer ID."
              }
            },
            "additionalProperties": false,
            "description": "The Plain customer identifier to use for exact lookup or mutation matching. Provide exactly one of emailAddress, externalId, or customerId."
          },
          "onCreate": {
            "type": "object",
            "properties": {
              "fullName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's full name."
              },
              "email": {
                "type": "string",
                "description": "The customer's primary email address.",
                "format": "email"
              },
              "emailVerified": {
                "type": "boolean",
                "description": "Whether Plain should mark the email address as verified."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "Your own stable external identifier for the customer."
              },
              "shortName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's optional short name."
              }
            },
            "additionalProperties": false,
            "required": [
              "fullName",
              "email"
            ],
            "description": "Action input."
          },
          "onUpdate": {
            "type": "object",
            "properties": {
              "fullName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's new full name."
              },
              "shortName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's new short name."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's new external identifier."
              },
              "email": {
                "type": "string",
                "description": "The customer's replacement email address.",
                "format": "email"
              },
              "emailVerified": {
                "type": "boolean",
                "description": "Whether Plain should mark the replacement email as verified."
              }
            },
            "additionalProperties": false,
            "description": "Action input."
          }
        },
        "additionalProperties": false,
        "required": [
          "identifier",
          "onCreate",
          "onUpdate"
        ],
        "description": "Action input."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "result": {
            "type": "string",
            "enum": [
              "CREATED",
              "UPDATED",
              "NOOP"
            ],
            "description": "Whether Plain created, updated, or left the customer unchanged."
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "description": "The Plain customer ID."
              },
              "externalId": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Your own external identifier stored on the customer."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fullName": {
                "type": "string",
                "minLength": 1,
                "description": "The customer's full name."
              },
              "shortName": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's optional short name."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "description": "The customer's primary email address.",
                "format": "email"
              },
              "emailVerified": {
                "type": "boolean",
                "description": "Whether the customer's primary email address is verified."
              },
              "avatarUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "The customer's avatar URL when Plain has one."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "description": "The customer's creation timestamp.",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "description": "The customer's update timestamp.",
                "format": "date-time"
              }
            },
            "additionalProperties": false,
            "required": [
              "id",
              "externalId",
              "fullName",
              "shortName",
              "email",
              "emailVerified",
              "avatarUrl",
              "createdAt",
              "updatedAt"
            ],
            "description": "Action output."
          }
        },
        "additionalProperties": false,
        "required": [
          "result",
          "customer"
        ],
        "description": "Action output."
      }
    }
  ]
}
