Remove all current contacts and upload a new mailing list
PUT https://www.prayerletters.com/api/v1/contacts

The body of the request should be formatted identically to the response from the GET call.

When you include a non-null external_id field with a record, the response will contain a mapping between your ID and the contact_id at prayerletters.com. You can then use the contact_id to update or delete the record as needed.

Example Request

{ "contacts" : [ { "address" : { "city" : "Lebanon", "country" : "", "postal_code" : "03766", "state" : "NH", "street" : "123 Main St." }, "company" : null, "contact_id" : "c-0x7-pzm5", "external_id" : "0123456", "file_as" : "Tischler, Joe", "greeting" : "Joe and Mary", "name" : "Joe and Mary Tischler" }, { "address" : { "city" : "West Lebanon", "country" : "", "postal_code" : "03784", "state" : "NH", "street" : "30 Airport Road, Suite 1" }, "company" : "prayerletters.com", "contact_id" : "c-3s1-hnvf", "external_id" : null, "file_as" : "prayerletters.com", "greeting" : "prayerletters.com", "name" : "Customer Service" } ] }

Successful Response

HTTP/1.1 200 OK

Error Responses

400 contacts.upload_body_missing
The request did not contain any content
400 contacts.upload_insufficient_address
At least one contact does not appear to have a mailing address (at least one of street or city must be filled in).
400 contacts.upload_invalid_address
At least one contact contains an address attribute that isn't a JSON object.
400 contacts.upload_missing_address
At least one contact is missing an address attribute.
400 contacts.upload_missing_name
At least one contact is missing a name or company.
412 contacts.upload_invalid_contacts_attribute
The contacts attribute must be an array.
412 contacts.upload_invalid_content
The content must be a JSON object.
412 contacts.upload_invalid_format
The content must be a JSON file.
412 contacts.upload_missing_contacts_attribute
The JSON file must contain a contacts array.
413 contacts.upload_too_large
By default, uploads may not exceed 2MB. If you need a larger quota, please contact us.
423 contacts.locked
Another API call is already in the process of replacing contacts on this account.
429 contacts.too_many_requests
Database-intensive queries have lower thresholds for throttling. Contact us if you need higher limits for testing purposes.
500 contacts.error_creating_record

There was a database error on our end.

Important: the mailing list may now be in an inconsistent state. We recommend sending a Delete All Contacts request, then sending this PUT request again. If you get the same error, Delete All Contacts again to ensure that a mailing isn't submitted to a partially-uploaded list, and contact us for assistance.

As a workaround, give the user of your application a copy of the mailing list in another format (e.g. CSV or Excel), and ask them to send it to us with their mailing (either through our web site or by email). We will be able to import the list and continue with any active orders once the database error has been resolved.