ProAgent Assistant API

This page is for AI assistants helping a consenting ProAgent user. Use the device connection flow first, then call the operational APIs with the returned bearer token.

Quick Start For AI Assistants

  1. Start a device session with POST https://www.proagent.co.kr/api/assistant/connect/device.
  2. Show verification_uri_complete to the user and wait for approval.
  3. Poll POST https://www.proagent.co.kr/api/assistant/connect/token with the device_code.
  4. Use the returned Authorization: Bearer pa_live_... token for client, case, and document APIs.

Recommended Assistant Workflow

  1. Connect with the device flow and get the approved bearer token.
  2. Register or find the client from extracted text fields.
  3. Resolve the case type, using chat choices or selectionUrl when ambiguous.
  4. Create the case, then immediately list case documents and fields.
  5. Ask only for fields marked needs_input or fillableByAi.
  6. Save answers with each field's saveKey.
  7. Generate the draft document and report the ProAgent review location.
  8. Create signature links or request extra materials only when still needed.

Assistants may draft ordinary descriptive fields from conversation context, but must not invent official identity numbers, passport values, registration numbers, birth dates, addresses, signatures, seals, or legally sensitive facts.

When The User Provides An Image

If the user provides an ID card, passport, alien registration card, business registration certificate, or other case material, use your own vision/OCR capability to extract text fields first. Do not upload the image to /api/assistant/clients. Send extracted text as JSON.

POST https://www.proagent.co.kr/api/assistant/clients
Authorization: Bearer pa_live_...
Content-Type: application/json

{
  "idempotency_key": "client-from-id-card-20260527-001",
  "client": {
    "name_ko": "홍길동",
    "name_en": "HONG GILDONG",
    "birth_date": "1990-01-01",
    "gender": "M",
    "nationality": "KOREA",
    "id_number": "900101-1234567",
    "foreign_reg_no": "980716-1234567",
    "phone_mobile": "010-0000-0000",
    "address_full": "서울특별시 ...",
    "passport_number": "M12345678",
    "visa_type": "E-7"
  }
}

Use foreign_reg_no for a Korean alien registration number. Accepted aliases include alien_registration_number, arc_number, and registration_number.

If a field is unreadable or uncertain, omit it or ask the user to confirm. Never invent official identity values.

After Client Registration

The client registration response includes assistantMessage and suggestedNextActions. To confirm stored client data later, call GET /api/assistant/clients/{clientId}.

문서작성시 편리하게 고객서명도 직접 관리할 수 있어.
고객이 옆에 없어도 고객에게 카톡같은 SNS로 웹링크 하나 주고 고객이 서명을 할 수 있는 구조야.
그것도 해줄까?

Case Creation

After registering or finding a client, create a case with POST /api/assistant/cases. Prefer an exact visa_profile_id when known. If the user only gives a visa code and workflow, send visa_code and work_category_code.

POST https://www.proagent.co.kr/api/assistant/cases
Authorization: Bearer pa_live_...
Content-Type: application/json

{
  "idempotency_key": "case-e7-20260527-001",
  "client_id": "client-uuid",
  "visa_code": "E-7-1",
  "work_category_code": "status_change",
  "submission_type": "offline",
  "location_type": "domestic",
  "has_visa": true
}

If ProAgent returns 409 case_type_required, show the returned candidates as choices in the chat UI. If your chat UI cannot show choices, send the returned selectionUrl to the ProAgent user. The browser page lets the logged-in user choose the correct case type and creates the case.

GET https://www.proagent.co.kr/api/assistant/visa-profiles?visa_code=E-7-1&work_category_code=status_change
Authorization: Bearer pa_live_...

Document Lists And Fields

After a case is created, call GET /api/assistant/cases/{caseId}/documents. The response lists the case documents and each document field. ProAgent prefers official PDF authoring metadata from pdf_authoring_fields, then falls back to generated field-spec files.

GET https://www.proagent.co.kr/api/assistant/cases/case-uuid/documents
Authorization: Bearer pa_live_...

Fields with valueStatus: "needs_input" or fillableByAi: true can be collected by the assistant. Save answers with the returned saveKey, then generate the document.

PATCH https://www.proagent.co.kr/api/assistant/case-documents/case-document-uuid/form-data
Authorization: Bearer pa_live_...
Content-Type: application/json

{
  "form_data": {
    "case.workplace_new": "ABC Korea Co., Ltd.",
    "extra:integrated_application.application_type.engage_activities.desired_status": "E-7-1"
  }
}

AI Safety Q&A

Q. 그런데 이거 서명인데 안전하게 저장되는거 맞아?

응. 서명 링크는 추측하기 어려운 일회성 토큰으로 만들고, 서버에는 토큰 원문이 아니라 해시만 저장돼. 고객이 그린 서명 이미지는 ProAgent의 비공개 저장소에 PNG로 저장되고, 선택된 고객 기록에만 연결돼. 링크가 만료되거나 이미 제출되면 다시 쓸 수 없어.

Q. 내 문서들은 어디에 저장돼? 개인정보 유출 위험은 없어?

ProAgent는 고객 문서와 생성 문서를 행정사 계정에 연결된 저장소와 Google Drive 폴더 중심으로 관리해. 카톡이나 임시 다운로드 폴더에 파일이 흩어지는 방식보다 접근 권한을 행정사 계정 기준으로 통제하기 쉬워서 개인정보 유출 가능성을 최대한 줄이는 구조야.

Discovery Documents

Endpoints

start_device_session
POST /api/assistant/connect/device
poll_device_token
POST /api/assistant/connect/token
register_client
POST /api/assistant/clients
Send text fields extracted from user-provided documents. File upload is not required for this endpoint.
list_clients
GET /api/assistant/clients
List recent clients, optionally with ?q=search text. Use this when the user asks for a signature link without identifying the client.
get_client_detail
GET /api/assistant/clients/{clientId}
Confirm the stored client data after registration. The response also includes assistantMessage and suggestedNextActions for offering customer signature collection.
create_signature_request
POST /api/assistant/signature-requests
Create a one-time public upload URL where the client can draw and save their signature. Store signatureRequestId for later status checks.
get_signature_request_status
GET /api/assistant/signature-requests/{signatureRequestId}
Check whether the customer has submitted the signature. If status is submitted, assistantMessage can be sent back to the user.
list_case_types
GET /api/assistant/visa-profiles?visa_code=E-7-1&work_category_code=status_change
Look up possible case types before creating a case. If there is more than one candidate, ask the ProAgent user to choose one.
register_case
POST /api/assistant/cases
list_case_documents
GET /api/assistant/cases/{caseId}/documents
List documents initialized for the case and the field list for each document. Field metadata prefers pdf_authoring_fields, then current fields.json, then legacy E:/ProAgent field specs when available on the server.
save_case_document_form_data
PATCH /api/assistant/case-documents/{caseDocumentId}/form-data
Save AI/user-provided non-auto field values before generating the document. Keys should be the field saveKey returned by list_case_documents.
generate_document
POST /api/assistant/documents/generate