Import customers
POST
/api/customers/import
const url = 'https://example.com/api/customers/import';const options = { method: 'POST', headers: { cookie: 'better-auth.session_token=<better-auth.session_token>', 'Content-Type': 'application/json' }, body: '{"content":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/customers/import \ --header 'Content-Type: application/json' \ --cookie better-auth.session_token=<better-auth.session_token> \ --data '{ "content": "example" }'Admin only. Requires an authenticated session with the admin role.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”CSV file contents to parse and upsert.
Media type application/json
CSV file contents for customer import.
object
content
required
string
Example generated
{ "content": "example"}Responses
Section titled “ Responses ”Number of customers imported.
Media type application/json
object
count
required
integer
errors
required
Array<object>
object
index
integer
name
string
message
required
string
Example generated
{ "count": 1, "errors": [ { "index": 1, "name": "example", "message": "example" } ]}The import body was invalid.
Media type application/json
object
error
required
string
errors
Array<object>
object
index
integer
name
string
message
required
string
Example generated
{ "error": "example", "errors": [ { "index": 1, "name": "example", "message": "example" } ]}No valid Better Auth session was present.
Media type application/json
Returned when no valid Better Auth session is present.
object
error
required
string
Example generated
{ "error": "example"}The import failed while writing customers.
Media type application/json
object
error
required
string
errors
Array<object>
object
index
integer
name
string
message
required
string
Example generated
{ "error": "example", "errors": [ { "index": 1, "name": "example", "message": "example" } ]}