POST /fields/{field_id}/train

Add training data to train a field. This allows you to specify the locations of text you would like to train a field on. This endpoint will return a request_id that can be used to check the status, metadata and accuracy of your training request.


Authorization (required) - Requires the standard authentication header used in the system.


  • field_id Path Required

    the id for the field to train

  • file_id Body Required

    the id of the file you want to use to train

  • locations Body Required

    the start and end positions of the text you’d like to train on

Code Sample
curl -X POST -H "Accept: application/json"  
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d "{
request, _ = zdai.fields.train(field_id=’fieldID’, annotations=[{‘file_id’: ‘fileID’, ‘locations’:[{‘start’: 100, ‘end’: 200}]}])
Response Codes
  • 202 Accepted
    Training request has been created successfully.
  • 400 Bad Request
    Malformed request body, or field_id,file_id or locations are missing.
  • 403 Forbidden
    Invalid or missing authentication token.
  • 409 Conflict
    The field_id has an on-going training session
  • 500 Internal Server Error
    Something went wrong unrelated to the users request.

Response Data

  • field_id

    the field identifier. This can be used in other endpoints

  • status

    the status of the request. Could be queued or complete

  • request_id

    the request identifier that can be used to retrieve the train results

    "field_id": "2efb79d4-857d-46de-8097-f70668157dbf",
    "status": "queued",
    "request_id": "c71qfcco2ua9dqja2d70"

Need Help?

Couldn’t find the information you were looking for or need more assistance?

Contact Support