End to end
A whole integration in three curl calls.
BASE_URL="https://api.morphic.com/v1/partner" # a mor_test_ key uses https://api.morphic.today/v1/partner
# 1. what this workflow needs
curl -s "$BASE_URL/workflows/$WORKFLOW_ID/inputs" \
-H "Authorization: Bearer $MORPHIC_API_KEY"
# 2. start the run
curl -s -X POST "$BASE_URL/workflow-runs" \
-H "Authorization: Bearer $MORPHIC_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"org_id": "'"$ORG_ID"'",
"project_id": "'"$PROJECT_ID"'",
"workflow_id": "'"$WORKFLOW_ID"'",
"idempotency_key": "story-48213-v2",
"inputs": {
"story_document": "https://cdn.example.com/stories/48213.pdf",
"tone": "thriller"
}
}'
# 3. follow it to a terminal status
curl -s "$BASE_URL/workflow-runs/$RUN_ID?wait=45" \
-H "Authorization: Bearer $MORPHIC_API_KEY"A production integration adds
- An
idempotency_keyper unit of work, stored with your own record, so a retry after a timeout cannot start a second run. - The run id persisted against that record before you do anything else — it is the only handle on work you are already being billed for.
- A webhook, with polling kept as the fallback for runs you have not heard about.
- Assets downloaded to your own storage on arrival, because
urlexpires. x-morphic-trace-idlogged on every response.