Hi, Christopher.
>We would like to automate with APIor script SP trustrelationshps.
There is no API currently which can do this. Feel free to submit a feature request at Github if you have an idea of how it could be implemented, web UI's API is planned to be revised in the near future.
For now your best option is to create it via direct writes to LDAP database. You could study composition of TR entries there, experimenting how different web UI settings are represented in them, to start with.
Another thing to consider would be whether you actually want to stick to SAML that badly. In case it's possible to adopt OIDC in your setup, you would have Dynamic Registration mechanics at your displosal right out-of-the box, so no need for writing and maintaining complex external tools.
>Looking at the 3.1.1 docs, it talks about generating IDs and includes a “tRelationship” type
If you are referring to [this](https://gluu.org/docs/ce/api-guide/api/), it's about generating inums, a unique id each entry in Gluu's LDAP tree is assigned. You'll also need it to assemble a TR's configuration entry.