Skip to main content
DraftLC Logo

API reference

Draft a credit from your own systems

Integrate DraftLC into your applications and workflows. API access is available on the Pro plan.

Authentication

Pro API usage shares the web weekly allowance. Prepaid credits are used first, then overage is recorded at US$8 per completed draft for billing review; no automatic charges occur. All API requests must be authenticated with an API key generated from your account settings. Pass your key in the Authorization header as a Bearer token.

Authorization: Bearer <YOUR_API_KEY>

POST
/api/v1/draft

Generates a new L/C draft from one or more trade documents.

Request Body

The body must be a JSON object with a `documents` array. Each object in the array represents a file and must contain `fileName` and a Base64-encoded `dataUri`.

{
  "documents": [
    {
      "fileName": "proforma-invoice.pdf",
      "dataUri": "data:application/pdf;base64,JVBERi0xLjc..."
    },
    {
      "fileName": "sales-contract.docx",
      "dataUri": "data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,UEsDBBQABgAIAAAAIQD..."
    }
  ]
}

Example Request (cURL)

curl -X POST https://your-app-domain.com/api/v1/draft \
  -H "Authorization: Bearer lc_your_api_key_here" \
  -H "Content-Type": "application/json" \
  -d '{
    "documents": [
      {
        "fileName": "invoice.pdf",
        "dataUri": "data:application/pdf;base64,..."
      }
    ]
  }'

Success Response (200 OK)

The response will be a JSON object containing the generated L/C draft, strategic analysis, and suggestions.

{
    "title": "L/C Draft - Textile Export to India",
    "applicant": "Company Name, 123 Main St, Anytown, USA",
    "beneficiary": "Supplier Inc, 456 Trade Ave, Tradetown, Germany",
    "amount": "150000.00",
    "currency": "USD",
    "status": "Ready for Issuance, Subject to Applicant's Final Approval",
    "analysis": "...",
    "draftLC": ":27: 1/1\n:40A: IRREVOCABLE...",
    "suggestions": ["Optimization: ..."],
    "documentClassifications": [{"fileName": "invoice.pdf", "documentType": "Proforma Invoice"}]
}

Error Responses

  • 401 Unauthorized
    The API key is missing, invalid, or malformed.
  • 403 Forbidden
    The API key is valid, but the user is not on the Pro tier.
  • 503 Service Unavailable
    Generation capacity or usage enforcement temporarily unavailable. Pro generation continues as recorded overage after allowance and prepaid credits.
  • 500 Internal Server Error
    An unexpected error occurred during draft generation.