> For the complete documentation index, see [llms.txt](https://kevins-organization-58.gitbook.io/smtp-ghost-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kevins-organization-58.gitbook.io/smtp-ghost-api/error-handling.md).

# Error Handling

All error responses use JSON with an `"error"` or `"message"` field and the appropriate HTTP status code.

### Common HTTP Status Codes

| Status Code | Meaning                                              |
| ----------- | ---------------------------------------------------- |
| **400**     | Bad Request – missing or malformed input.            |
| **401**     | Unauthorized – missing or invalid API key.           |
| **402**     | Payment Required – insufficient credits.             |
| **404**     | Not Found – resource or endpoint does not exist.     |
| **422**     | Unprocessable Entity – validation failed.            |
| **500**     | Internal Server Error – unexpected server exception. |

### Error Response Format

```json
{
  "error": "Descriptive error message here."
}

```

Or for validation failures:

```json
{
  "status": "unprocessable",
  "message": "Unable to extract name or domain.",
  "profile": { /* partial profile data */ }
}

```

### Examples

#### 400 Bad Request

```bash
bashCopyEditcurl -X POST https://smtpghost.com/api/v1/linkedin_finder \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json
{
  "error": "Please provide a LinkedIn URL."
}
```

#### 401 Unauthorized

```bash
curl -X POST https://smtpghost.com/api/v1/linkedin_finder \
  -H "Content-Type: application/json" \
  -H "X-KEY: WRONG_KEY" \
  -d '{ "linkedin_url": "…" }'
```

```json
{
  "error": "Unauthorized: Invalid API Key or Organization not found"
}
```

#### 402 Payment Required

```json
{
  "error": "Insufficient credits. You need 1 credits to perform LinkedIn email finder."
}
```

#### 422 Unprocessable Entity

```json
{
  "status": "unprocessable",
  "message": "Unable to extract name or domain.",
  "profile": { /* partial profile data */ }
}
```

#### 500 Internal Server Error

```json
{
  "error": "An internal error occurred: Connection timed out"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kevins-organization-58.gitbook.io/smtp-ghost-api/error-handling.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
