To override template defaults when creating an agreement, custom values can be passed into the agreement body based on the type of agreement being sent out.
curl -H 'Authorization: Bearer YOUR_API_KEY' -H "Content-type: application/json" -d '{
"template_id": "TEMPLATE_ID",
"owner_email": "OWNER_EMAIL",
"signer_email": "SIGNER_EMAIL",
"agreement": {
"recipient_name": "Recipient Name",
"recipient_email": "RECIPIENT_EMAIL",
"recipient_organization_name": "RECIPIENT_ORG",
"message": "This is the agreement we spoke about.",
"test_agreement": false,
"csa_order_form_attributes": {
"fees_attributes": {
"0": {
"description": "Description of a flat fee",
"type": "Fees::Flat",
"cost": 10000
}
}
}
}
}' 'https://api.commonpaper.com/v1/agreements'
This would add an extra fee on-top of any fees currently applied to the template.
"csa_order_form_attributes": {
"fees_attributes": {
"0": {
"description": "Flat fee",
"type": "Flat::Fee",
"cost": 50
},
"1": {
"description": "Fees discount",
"type": "Fees::Discount",
"cost": 100,
"discount_type": "fixed_amount",
"discount_duration_type": "forever"
},
"2": {
"description": "Fees attachment",
"type": "Fees::Attachment",
"attachment_id": "ID"
}
}
}
If the template type does not correspond to the overridden attribute type, the agreement creation will fail.
To retrieve fields specific to an agreement type you can: