# API

Mavenseed has a RESTful API that is available to account owners. It can be accessed at *<https://yoursite.mavenseed.com/api/v1>*

Authentication is handled via a secure token, which is used to make requests after logging into the API with your account email and password.

### API Login

Send a POST request to `https://yoursite.mavenseed.com/api/login` with the email and password that you used to create your account with. In the return response, you will receive an authentication token that you can use to make future requests with.

## API Login

<mark style="color:green;">`POST`</mark> `https://yoursite.mavenseed.com.com/api/login`

#### Query Parameters

| Name     | Type   | Description      |
| -------- | ------ | ---------------- |
| email    | string | Account email    |
| password | string | Account password |

{% tabs %}
{% tab title="200 " %}

```
{'auth_token': 'XXXXXX'}
```

{% endtab %}
{% endtabs %}

### API Requests

Further requests to the API require the auth token that was returned to you after logging in through the API. Here's an example request that includes the auth token to grab all events. The auth token is sent in the headers of the request.

`curl --header "Authorization: Bearer TOKEN-FROM-LOGIN" https://yoursite.mavenseed.com/api/v1/events`

The rest of this documentation assumes that the auth token will be present in the requests to the API.

Just a heads up, the documentation tool here makes it a bit hard to understand the format of the requests to the api. The case is the same for all API resources, but for example let's consider a "customer". Here's a screenshot that shows that the properties that you're trying to either create, update, or destroy, requires to be nested within the resource name. This should be in JSON in your request to the API.

Example: `{ "customer": { "email": "apiupdate@sdsdsd.com"}}`

Here's an example using Ruby to update a customers email.

```ruby
require 'uri'
require 'net/http'

url = URI("https://yoursite.mavenseed.com/api/v1/customers/55")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer AUTHTOKENFROMLOGIN'
request["cache-control"] = 'no-cache'
request["Postman-Token"] = 'eb9d400b-9e60-4f2e-a72a-289adbf66f34'
request.body = "{ \"customer\": { \"email\": \"updatetheemail@someusersemail.com\"}}"

response = http.request(request)
puts response.read_body
```

If you have any questions on any of this, just email me <nick@mavenseed.com>


---

# Agent Instructions: 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:

```
GET https://docs.mavenseed.com/developers/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
