# API Status Codes


The following are the main HTTP status codes that the API sends.


1. `400` - this is main error status code. This usually indicates that either something went wrong in processing your request, or the request parameters are invalid. Normally, a message parameter is included in the response which gives the context of the 400 error status code.

2. `401` - this indicates a login failed attempt, i.e. the API failed to authenticate the user included in the API request.

3. `299` - this status code is usually set for deprecated API calls like `Sub/List::IsSubscriberOnList` which indicates that the API request failed successfully.

4. `200` - this is the success status code. Indicates that the request was processed succesfully.



### Request API Endpoints Status Codes and Message Details


#### List::GetListSubscribers

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Start date and end dates are only supported if statuses are either: 'bounced', 'unsubscribed', 'active', 'inactive'` - this tells the user that the start and end date request parameters are only accepted is the status parameter is present and includes the values: 'bounced', 'unsubscribed', 'active', 'inactive'

- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/databases in the request.


#### Segment::GetSegmentSubscribers

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some segment}` - this indicates that the user has no access to one of the referenced segments in the request.


#### Sub/List::AddSubscribersToList

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Invalid {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Request too large.Try submitting your contacts in batches of 10,000 or less per request.` - this indicates that the request payload is too large. Mainly if the request contains more than 10,000 contacts to add.

- `The following custom field {custom field 1} is ambiguous` - this indicates that one of the custom fields include in the request is ambigious, i.e. there contains a similar custom field with a similar name and the API won't know the correct custom field to process.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `subscribers.add`



#### Sub/List::AddOrUpdateSubscribers

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Invalid {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Paylod too large.Try submitting your contacts in batches of 10,000 or less per request.` - this indicates that the request payload is too large. Mainly if the request contains more than 10,000 contacts to add.

- `The following custom field {custom field 1} is ambiguous` - this indicates that one of the custom fields include in the request is ambigious, i.e. there contains a similar custom field with a similar name and the API won't know the correct custom field to process.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `subscribers.edit`


#### Newsletters::AddJourneyNewsletter

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Invalid {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `No list found with the provided name` - this indicates that the list/database matching the name provided in the request is not found.

- `No list found with the provided id` - this indicates that the list/database matching the ID provided in the request is not found.

- `No newsletter found matching {newsletter}` - this indicates that the newsletter provided in the request is not found.

- `More than one campaign found matching {newsletter}` - this indicates that the newsletter provided in the request has more than one match.

- `More than one journey found with the provided campaign and list` - this indicates that the newsletter provided and list is involved in more than one journey.

- `Journey is not inactive, cannot modify resend status` - this indicates that the journey found is not inactive and resend status cannot be modified.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `journeys.useapi`

- `Failed to create journey: {error message context}` - this indicates an error occured while trying to create the journey. The {error message context} provides more context on why the creation failed.E.g. `A Journey with the same name already exists`


#### Journeys::AddSubscriberToJourney

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Invalid {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `No journey found with the provided name"` - this indicates that the journey matching the name provided in the request is not found.

- `No journey found with the provided id` - this indicates that the journey matching the id provided in the request is not found.

- `More than one journey found with the provided name` - this indicates that the journey matching the name provided has more than one match.

- `No subscriber found with the provided email: {$email}` - this indicates that the email provided does not match a subscriber.

- `No subscriber found with the provided id or not in the right list` - this indicates that the no subscriber is found with the provided id or is not in the list/database provided.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `journeys.useapi`


#### Journeys::SendJourneyNewsletter

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Invalid {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `No list found with the provided name` - this indicates that the list/database matching the name provided in the request is not found.

- `No list found with the provided id` - this indicates that the list/database matching the ID provided in the request is not found.

- `No newsletter found matching {newsletter}` - this indicates that the newsletter provided in the request is not found.

- `More than one campaign found matching {newsletter}` - this indicates that the newsletter provided in the request has more than one match.

- `More than one journey found with the provided campaign and list` - this indicates that the newsletter provided and list is involved in more than one journey.

- `Journey is not inactive, cannot modify resend status` - this indicates that the journey found is not inactive and resend status cannot be modified.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `journeys.useapi`

- `Failed to create journey: {error message context}` - this indicates an error occured while trying to create the journey. The {error message context} provides more context on why the creation failed.E.g. `A Journey with the same name already exists`

- `No journey found with the provided name"` - this indicates that the journey matching the name provided in the request is not found.

- `No journey found with the provided id` - this indicates that the journey matching the id provided in the request is not found.

- `More than one journey found with the provided name` - this indicates that the journey matching the name provided has more than one match.

- `No subscriber found with the provided email: {$email}` - this indicates that the email provided does not match a subscriber.

- `No subscriber found with the provided id or not in the right list` - this indicates that the no subscriber is found with the provided id or is not in the list/database provided.


#### Newsletters::SendNewsletter

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some newsletter}` - this indicates that the user has no access to one of the referenced newsletters in the request.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `newsletters.send`

- `Invalid send start date parameter. The value provided should be a datetime in the future` - this indicates that the user has entered a past date and that the required date must be in the future.

- `No valid list ID values found. Please check your list, tag, and segment IDs.` - this indicates that there's no valid lists/database found in the provided lists/segments/tags.

- `No access to {some list}` - this indicates that the user has no access to one of the computed/provided lists/databases

- `No access to {some tag}` - this indicates that the user has no access to one of the computed/provided tags

- `No access to {some segment}` - this indicates that the user has no access to one of the computed/provided segments

- `subscribercount: {count}` - this indicates that the matching subscriber count is less than 1 and thus the newsletter cannot be scheduled to be sent

- `Failed to create new send job -- no subscribers found` - this indicates that a job to process the newsletter send failed to be created


#### Newsletters::SendPreview

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some newsletter}` - this indicates that the user has no access to one of the referenced newsletters in the request.

- `Internal error: invalid permission check.` - this indicates that user making the request does not have the permission `newsletters.send`

- `failed to load newsletterid {newsletterid}` - this indicates that the system failed to load the newsletter from the DB or the newsletter is not found in the DB

- `A preview couldn\'t be sent: You do not have the required permissions.` - this indicates that the user does not have permission to send newsletters

- `newsletter body (text & html) is empty.` - this indicates that the provided newsletter has an empty text or html body and thus a preview cannot be sent.

- `can't open preview file {preview_file}` - this indicates that there was an error opening a preview file created while trying to process the "send preview" request.

- `Preview limit exceeded, please try again in {x} seconds` - this indicates that the user has hit the preview limit and cannot send a preview.

- `No email address was supplied. Please try again.` - this indicates that the request parameter `*preview-email` was empty and no valid email was provided.

- `Unable to send preview email.` - this indicates that an error occurred that prevented the sending of the preview email, e.g. smtp server failing


#### Tag::CreateTags

The main HTTP status code this endpoint can return are:


- `400` - either validation failed, or an error occurred

- `401` - if the API fails to authenticate the current user.

- `200` - the request is process successfully


##### Error Messages

Some of the messages that can be returned in the case of `400` are:


- `Invalid {some parameter name}` or `Missing {some parameter name}` - this message indicates that a request parameter may be missing from the request and is required or the parameter has an invalid value

- `No access to {some list}` - this indicates that the user has no access to one of the referenced lists/database in the request.

- `Tag '{name}' already exists` - this indicates that one of the tags provided with the {name} already exists.

- `Tag '{name}' creation failed` - this indicates that one of the tags with the {name} failed to be created

- `No tags created` - this indicates that none of the provided tag was created