Extract Contract Clause Data

Extract parties, dates, and clauses from a contract into structured JSON for legal review workflows.

Who this is for

Legal teams and contract management platforms use this recipe to automate contract review. Upload a contract and receive structured JSON with involved parties, key dates, and individual clauses — ready for a compliance check, risk analysis, or contract database.

Request
curl -X POST https://api.iterationlayer.com/document-extraction/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "type": "url",
        "name": "contract.pdf",
        "url": "https://example.com/contracts/service-agreement.pdf"
      }
    ],
    "schema": {
      "fields": [
        {
          "name": "parties",
          "type": "ARRAY",
          "description": "Parties involved in the contract",
          "fields": [
            {
              "name": "name",
              "type": "TEXT",
              "description": "Name of the party"
            },
            {
              "name": "role",
              "type": "TEXT",
              "description": "Role of the party (e.g. client, provider)"
            }
          ]
        },
        {
          "name": "effective_date",
          "type": "DATE",
          "description": "Date the contract takes effect"
        },
        {
          "name": "termination_date",
          "type": "DATE",
          "description": "Date the contract expires or terminates"
        },
        {
          "name": "clauses",
          "type": "ARRAY",
          "description": "Individual contract clauses",
          "fields": [
            {
              "name": "title",
              "type": "TEXT",
              "description": "Clause heading or title"
            },
            {
              "name": "content",
              "type": "TEXTAREA",
              "description": "Full text of the clause"
            }
          ]
        }
      ]
    }
  }'
Response
{
  "success": true,
  "data": {
    "parties": {
      "value": [
        {
          "name": {
            "value": "Nexus Technologies Inc.",
            "confidence": 0.98,
            "citations": ["Nexus Technologies Inc."]
          },
          "role": {
            "value": "Client",
            "confidence": 0.96,
            "citations": ["hereinafter the \"Client\""]
          }
        },
        {
          "name": {
            "value": "CloudServe Solutions LLC",
            "confidence": 0.97,
            "citations": ["CloudServe Solutions LLC"]
          },
          "role": {
            "value": "Provider",
            "confidence": 0.95,
            "citations": ["hereinafter the \"Provider\""]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "effective_date": {
      "value": "2026-04-01",
      "confidence": 0.98,
      "citations": [
        "effective as of April 1, 2026"
      ]
    },
    "termination_date": {
      "value": "2028-03-31",
      "confidence": 0.97,
      "citations": [
        "terminating on March 31, 2028"
      ]
    },
    "clauses": {
      "value": [
        {
          "title": {
            "value": "Limitation of Liability",
            "confidence": 0.98,
            "citations": [
              "Section 8: Limitation of Liability"
            ]
          },
          "content": {
            "value": "Neither party shall be liable for any indirect, incidental, or consequential damages arising out of this agreement, except in cases of gross negligence or willful misconduct.",
            "confidence": 0.94,
            "citations": [
              "Neither party shall be liable for any indirect, incidental, or consequential damages"
            ]
          }
        },
        {
          "title": {
            "value": "Confidentiality",
            "confidence": 0.99,
            "citations": [
              "Section 5: Confidentiality"
            ]
          },
          "content": {
            "value": "Both parties agree to maintain the confidentiality of all proprietary information disclosed during the term of this agreement for a period of three years following termination.",
            "confidence": 0.93,
            "citations": [
              "maintain the confidentiality of all proprietary information"
            ]
          }
        }
      ],
      "confidence": 0.95,
      "citations": []
    }
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extract({
  files: [
    {
      type: "url",
      name: "contract.pdf",
      url: "https://example.com/contracts/service-agreement.pdf",
    },
  ],
  schema: {
    fields: [
      {
        name: "parties",
        type: "ARRAY",
        description: "Parties involved in the contract",
        fields: [
          {
            name: "name",
            type: "TEXT",
            description: "Name of the party",
          },
          {
            name: "role",
            type: "TEXT",
            description: "Role of the party (e.g. client, provider)",
          },
        ],
      },
      {
        name: "effective_date",
        type: "DATE",
        description: "Date the contract takes effect",
      },
      {
        name: "termination_date",
        type: "DATE",
        description: "Date the contract expires or terminates",
      },
      {
        name: "clauses",
        type: "ARRAY",
        description: "Individual contract clauses",
        fields: [
          {
            name: "title",
            type: "TEXT",
            description: "Clause heading or title",
          },
          {
            name: "content",
            type: "TEXTAREA",
            description: "Full text of the clause",
          },
        ],
      },
    ],
  },
});

console.log(result);
Response
{
  "success": true,
  "data": {
    "parties": {
      "value": [
        {
          "name": {
            "value": "Nexus Technologies Inc.",
            "confidence": 0.98,
            "citations": ["Nexus Technologies Inc."]
          },
          "role": {
            "value": "Client",
            "confidence": 0.96,
            "citations": ["hereinafter the \"Client\""]
          }
        },
        {
          "name": {
            "value": "CloudServe Solutions LLC",
            "confidence": 0.97,
            "citations": ["CloudServe Solutions LLC"]
          },
          "role": {
            "value": "Provider",
            "confidence": 0.95,
            "citations": ["hereinafter the \"Provider\""]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "effective_date": {
      "value": "2026-04-01",
      "confidence": 0.98,
      "citations": [
        "effective as of April 1, 2026"
      ]
    },
    "termination_date": {
      "value": "2028-03-31",
      "confidence": 0.97,
      "citations": [
        "terminating on March 31, 2028"
      ]
    },
    "clauses": {
      "value": [
        {
          "title": {
            "value": "Limitation of Liability",
            "confidence": 0.98,
            "citations": [
              "Section 8: Limitation of Liability"
            ]
          },
          "content": {
            "value": "Neither party shall be liable for any indirect, incidental, or consequential damages arising out of this agreement, except in cases of gross negligence or willful misconduct.",
            "confidence": 0.94,
            "citations": [
              "Neither party shall be liable for any indirect, incidental, or consequential damages"
            ]
          }
        },
        {
          "title": {
            "value": "Confidentiality",
            "confidence": 0.99,
            "citations": [
              "Section 5: Confidentiality"
            ]
          },
          "content": {
            "value": "Both parties agree to maintain the confidentiality of all proprietary information disclosed during the term of this agreement for a period of three years following termination.",
            "confidence": 0.93,
            "citations": [
              "maintain the confidentiality of all proprietary information"
            ]
          }
        }
      ],
      "confidence": 0.95,
      "citations": []
    }
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract(
    files=[
        {
            "type": "url",
            "name": "contract.pdf",
            "url": "https://example.com/contracts/service-agreement.pdf",
        }
    ],
    schema={
        "fields": [
            {
                "name": "parties",
                "type": "ARRAY",
                "description": "Parties involved in the contract",
                "fields": [
                    {
                        "name": "name",
                        "type": "TEXT",
                        "description": "Name of the party",
                    },
                    {
                        "name": "role",
                        "type": "TEXT",
                        "description": "Role of the party (e.g. client, provider)",
                    },
                ],
            },
            {
                "name": "effective_date",
                "type": "DATE",
                "description": "Date the contract takes effect",
            },
            {
                "name": "termination_date",
                "type": "DATE",
                "description": "Date the contract expires or terminates",
            },
            {
                "name": "clauses",
                "type": "ARRAY",
                "description": "Individual contract clauses",
                "fields": [
                    {
                        "name": "title",
                        "type": "TEXT",
                        "description": "Clause heading or title",
                    },
                    {
                        "name": "content",
                        "type": "TEXTAREA",
                        "description": "Full text of the clause",
                    },
                ],
            },
        ]
    },
)

print(result)
Response
{
  "success": true,
  "data": {
    "parties": {
      "value": [
        {
          "name": {
            "value": "Nexus Technologies Inc.",
            "confidence": 0.98,
            "citations": ["Nexus Technologies Inc."]
          },
          "role": {
            "value": "Client",
            "confidence": 0.96,
            "citations": ["hereinafter the \"Client\""]
          }
        },
        {
          "name": {
            "value": "CloudServe Solutions LLC",
            "confidence": 0.97,
            "citations": ["CloudServe Solutions LLC"]
          },
          "role": {
            "value": "Provider",
            "confidence": 0.95,
            "citations": ["hereinafter the \"Provider\""]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "effective_date": {
      "value": "2026-04-01",
      "confidence": 0.98,
      "citations": [
        "effective as of April 1, 2026"
      ]
    },
    "termination_date": {
      "value": "2028-03-31",
      "confidence": 0.97,
      "citations": [
        "terminating on March 31, 2028"
      ]
    },
    "clauses": {
      "value": [
        {
          "title": {
            "value": "Limitation of Liability",
            "confidence": 0.98,
            "citations": [
              "Section 8: Limitation of Liability"
            ]
          },
          "content": {
            "value": "Neither party shall be liable for any indirect, incidental, or consequential damages arising out of this agreement, except in cases of gross negligence or willful misconduct.",
            "confidence": 0.94,
            "citations": [
              "Neither party shall be liable for any indirect, incidental, or consequential damages"
            ]
          }
        },
        {
          "title": {
            "value": "Confidentiality",
            "confidence": 0.99,
            "citations": [
              "Section 5: Confidentiality"
            ]
          },
          "content": {
            "value": "Both parties agree to maintain the confidentiality of all proprietary information disclosed during the term of this agreement for a period of three years following termination.",
            "confidence": 0.93,
            "citations": [
              "maintain the confidentiality of all proprietary information"
            ]
          }
        }
      ],
      "confidence": 0.95,
      "citations": []
    }
  }
}
Request
package main

import (
    "fmt"
    il "github.com/iterationlayer/sdk-go"
)

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.Extract(il.ExtractRequest{
        Files: []il.FileInput{
            il.NewFileFromURL("contract.pdf", "https://example.com/contracts/service-agreement.pdf"),
        },
        Schema: il.ExtractionSchema{
            "parties": il.NewArrayFieldConfig(
                "parties",
                "Parties involved in the contract",
                il.ExtractionSchema{
                    "name": il.NewTextFieldConfig(
                        "name", "Name of the party",
                    ),
                    "role": il.NewTextFieldConfig(
                        "role",
                        "Role of the party (e.g. client, provider)",
                    ),
                },
            ),
            "effective_date": il.NewDateFieldConfig(
                "effective_date",
                "Date the contract takes effect",
            ),
            "termination_date": il.NewDateFieldConfig(
                "termination_date",
                "Date the contract expires or terminates",
            ),
            "clauses": il.NewArrayFieldConfig(
                "clauses",
                "Individual contract clauses",
                il.ExtractionSchema{
                    "title": il.NewTextFieldConfig(
                        "title", "Clause heading or title",
                    ),
                    "content": il.NewTextFieldConfig(
                        "content", "Full text of the clause",
                    ),
                },
            ),
        },
    })
    if err != nil {
        panic(err)
    }

    fmt.Println(result)
}
Response
{
  "success": true,
  "data": {
    "parties": {
      "value": [
        {
          "name": {
            "value": "Nexus Technologies Inc.",
            "confidence": 0.98,
            "citations": ["Nexus Technologies Inc."]
          },
          "role": {
            "value": "Client",
            "confidence": 0.96,
            "citations": ["hereinafter the \"Client\""]
          }
        },
        {
          "name": {
            "value": "CloudServe Solutions LLC",
            "confidence": 0.97,
            "citations": ["CloudServe Solutions LLC"]
          },
          "role": {
            "value": "Provider",
            "confidence": 0.95,
            "citations": ["hereinafter the \"Provider\""]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "effective_date": {
      "value": "2026-04-01",
      "confidence": 0.98,
      "citations": [
        "effective as of April 1, 2026"
      ]
    },
    "termination_date": {
      "value": "2028-03-31",
      "confidence": 0.97,
      "citations": [
        "terminating on March 31, 2028"
      ]
    },
    "clauses": {
      "value": [
        {
          "title": {
            "value": "Limitation of Liability",
            "confidence": 0.98,
            "citations": [
              "Section 8: Limitation of Liability"
            ]
          },
          "content": {
            "value": "Neither party shall be liable for any indirect, incidental, or consequential damages arising out of this agreement, except in cases of gross negligence or willful misconduct.",
            "confidence": 0.94,
            "citations": [
              "Neither party shall be liable for any indirect, incidental, or consequential damages"
            ]
          }
        },
        {
          "title": {
            "value": "Confidentiality",
            "confidence": 0.99,
            "citations": [
              "Section 5: Confidentiality"
            ]
          },
          "content": {
            "value": "Both parties agree to maintain the confidentiality of all proprietary information disclosed during the term of this agreement for a period of three years following termination.",
            "confidence": 0.93,
            "citations": [
              "maintain the confidentiality of all proprietary information"
            ]
          }
        }
      ],
      "confidence": 0.95,
      "citations": []
    }
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.