# Sugester API Documentation  -  REST API JSON

Full REST API to integrate your application with Sugester. JSON for clients, tasks, emails, deals, forms and more. Documentation and examples.

Sugester API Documentation - REST API JSON

Products
[CRM](/crm)[Helpdesk](/helpdesk)[Live Chat](/livechat)[Task management](/task-management)[Project management](/project-management)[VoIP](/voip)[Knowledge base](/knowledge-base)[Email](/better-e-mail)[Email marketing](/email-marketing)[Feedback](/feedback)[Forms and surveys](/forms-and-surveys)
More
[Integrations](/extensions-and-integrations)[Features](/features)[Pricing](/pricing)[Blog](/blog)[Contact](/contact)
[Log in](https://app.sugester2.pl/login?lang=en)[Try for free](/apply?cta=menu)

Developer docs

# Sugester API

Integrate your application with Sugester. REST API with JSON - clients, tasks, emails, deals, forms and more.

[Full documentation on GitHub](https://github.com/sugester/API)

How to integrate your application or service with sugester.com

The API allows you to add posts/suggestions/bugs etc. from other systems

After logging in to Sugester, go to Settings \> API to find working examples for your account.

## Table of contents

- API Token
- Usage examples

+ [Add a new client](#client_create)

+ [Get all clients data](#client_index)

+ [Get client data](#client_show)

+ [Update client data](#client_update)

+ [Delete a client](#client_destroy)

+ [Add a new task](#post_task_create)

+ [Get all tasks data (from helpdesk)](#post_task_index)

+ [Get task data](#post_task_show)

+ [Add a comment to task with id post\_id](#post_task_comment)

+ [Add a new deal](#deal_create)

+ [Update a deal](#deal_update)

+ [Get all deals data](#deal_index)

+ [Get deal data](#deal_show)

+ [Delete a deal](#deal_destroy)

+ [Add a contact](#contact_create)

+ [Get contact data](#contact_show)

+ [Update contact data](#contact_update)

+ [Add a contact list](#contact_lists_create)

+ [Get contact list data](#contact_lists_show)

+ [Update contact list data](#contact_lists_update)

+ [Add a post of type "error"](#post_error_create)

+ [Add a new account](#account_create)

+ [Integrations](#integrations)

+ [Add a new client](#integrations_new_client)

+ [Add a new deal](#integrations_new_deal)

- Client - specification
- Post - specification

## API token

The API authorization code (`API_TOKEN`) should be retrieved from the application settings: Settings \> API \> API authorization code. This way you won't need to provide your login/password in API calls.

## Usage examples

### Add a new client

```
curl http://YOUR-PREFIX.sugester.pl/app/clients.json\
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"client": {
    "name":"client 1 from API",
    "email": "client1@emailexample1.net",
    "note": "note 1"
  }
}'
```

### Get all clients data

```
curl http://YOUR-PREFIX.sugester.pl/app/clients.json?api_token=YOUR_API_TOKEN
```

### Get client data

```
curl http://YOUR-PREFIX.sugester.pl/app/clients/1234.json?api_token=YOUR_API_TOKEN
```

### Update client data

```
curl http://YOUR-PREFIX.sugester.pl/app/clients/1234.json\
     -X PUT \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"client": {
    "note": "note from API"
  }
}'
```

### Delete a client

```
curl -X DELETE  http://YOUR-PREFIX.sugester.pl/app/clients/12345.json?api_token=YOUR_API_TOKEN
```

### Add a new task

```
curl http://YOUR-PREFIX.sugester.pl/app/posts.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"post": {
    "title":"task title 1 from API",
    "content": "task content 1",
    "task_kind": "task",
    "client_id": null,
    "responsible_id": 1234
  }
}'
```

### Get all tasks data (from helpdesk)

```
curl http://YOUR-PREFIX.sugester.pl/app.json?api_token=YOUR_API_TOKEN
```

### Get task data

```
curl http://YOUR-PREFIX.sugester.pl/app/posts/1234.json?api_token=YOUR_API_TOKEN
```

### Add a comment to task with id post\_id

```
curl http://YOUR-PREFIX.sugester.pl/app/posts.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"post": {
    "post_id": 123,
    "title":"comment for task 123",
    "content": "comment content 1",
    "task_kind": "comment",
    "client_id": null,
    "responsible_id": 1234
  }
}'
```

### Add a new deal

```
curl http://YOUR-PREFIX.sugester.pl/app/deals.json\
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"deal": {
    "name":"deal 1 from API",
    "description": "desc 1",
    "client_id": null
  }
}'
```

### Update a deal

```
curl http://YOUR_PREFIX.sugester.pl/app/deals/1234.json\
    -X PUT \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '
{
"api_token": "YOUR_API_TOKEN",
"deal": {
   "description": "new description from API"
 }
}'
```

### Get all deals data

```
curl http://YOUR-PREFIX.sugester.pl/app/deals.json?api_token=YOUR_API_TOKEN
```

### Get deal data

```
curl http://YOUR-PREFIX.sugester.pl/app/deals/1234.json?api_token=YOUR_API_TOKEN
```

### Delete a deal

```
curl -X DELETE  http://YOUR-PREFIX.sugester.pl/app/deals/12345.json?api_token=YOUR_API_TOKEN
```

### Add a contact

```
curl http://YOUR_PREFIX.sugester.pl/app/contacts.json\
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '
{
"api_token": "YOUR_API_TOKEN",
"contact": {
   "name":"contact 1 from API",
   "description": "new contact from API",
   "first_name": "John",
   "last_name": "Doe",
   "responsible_id": 1,
   "email": "contact@example.com",
   "phone": "123456789"
 }
}'
```

### Get contact data

```
curl http://YOUR-PREFIX.sugester.pl/app/contacts/1234.json?api_token=YOUR_API_TOKEN
```

### Update contact data

```
curl http://YOUR_PREFIX.sugester.pl/app/contacts/1234.json\
    -X PUT \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '
{
"api_token": "YOUR_API_TOKEN",
"contact": {
   "description": "new description from API"
 }
}'
```

### Add a contact list

```
curl https://YOUR_PREFIX.sugester.pl/app/contact_lists.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_KEY",
"contact_list": {
    "name": "New contact list"
  }
}'
```

### Get contact list data

```
curl https://YOUR_PREFIX.sugester.pl/app/contact_lists/10.json?api_token=YOUR_API_TOKEN
```

### Update contact list data

```
curl https://YOUR_PREFIX.sugester.pl/app/contact_lists/10.json \
     -X PUT \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"contact_list": {
    "name": "New contact list updated"
  }
}'
```

### Add a post of type "error"

```
curl http://your-prefix.sugester.pl/app/posts.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "API_TOKEN",
"post": {
    "title":"post title2",
    "content": "post content 2",
    "kind": "error"
  }
}'
```

### Add a new account

```
curl http://YOUR-PREFIX.sugester.pl/app/account.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"account": {
    "prefix":"sugester2",
    "initial_module": "crm",
    "from_partner": "partner1"
 },
"user": {
    "login": "login1",
    "email": "email1@sugester-email.pl",
    "password": "password1"
 }
}'
```

## Integrations

### Add a new client

```
curl https://YOUR_PREFIX.sugester.pl/app/clients.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"client": {
    "name": "client 2 from External APP via API",
    "email": "c2@emailexample.net",
    "note": "note ext 2",
    "external_ids": {
        "myapp_client_id": "17"
    }
  }
}'
```

### Add a new deal

```
curl https://YOUR_PREFIX.sugester.pl/app/deals.json \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '
{
"api_token": "YOUR_API_TOKEN",
"deal": {
    "name": "deal 2 from External APP via API",
    "description": "desc 2",
    "price": 117,
    "client": {
        "name": "client 2 from External APP via API",
        "email": "c2@emailexample.net",
        "external_ids": {
            "myapp_client_id": "17"
        }
    },
    "external_ids": {
        "myapp_invoice_id": "21"
    }
  }
}'
```

## Client fields specification

```
{
	"id": client id
	"name": client name
	"tax_no": tax number
	"post_code": postal code
	"city": city
	"street": street
	"first_name": first name
	"country": country
	"email": email
	"phone": phone
	"www": website
	"fax": fax
	"created_at": created at
	"updated_at": updated at
	"street_no": street number
	"kind": kind (buyer/seller)
	"bank": bank name
	"bank_account": bank account
	"bank_account_id":
	"shortcut": name shortcut
	"note": note
	"last_name": last name
	"discount": discount
	"payment_to_kind": default invoice payment term
	"use_delivery_address": delivery address active
	"delivery_address": delivery address
	"mobile_phone": mobile phone
	"company": is company
	"register_number": register number
	"description": description
	"project_id": project id
	"contact_id": main contact id
	"appendixes_count": attachments count
	"posts_count": emails/tasks count
	"contacts_count": contacts count
	"last_activity": last activity
	"string1..10": custom fields
	"integer1..10": custom fields
	"decimal1..10": custom fields
	"checkbox1..10": custom fields
	"date1..10": custom fields
	"text1..10": custom fields
	"datetime1..10": custom fields
	"avatar_file_name": avatar
	"avatar_content_type"
	"avatar_file_size"
	"avatar_updated_at"
	"status_id": status id
	"category_id": category id
	"department_id": department id
	"position": position
	"creator_id": creator id
	"updater_id": last updater id
	"responsible_id": responsible person id
	"province": province/state
	"sensitive_data": sensitive data hidden
	"external_id": client external ID
	"token": client token
	"paid_from": paid from
	"paid_to": paid to
	"paid_total": total payments from client
}
```

## Post fields specification (Task/Suggestion/Report/Email)

```
{
    "id": post id
    "title": title
    "content": content
    "kind": suggestion type (suggestion, error, question, praise, private)
    "user_id": user id
    "points": points count
    "nick": user nick
    "votes_cache": votes count
    "comments_cache": comments count
    "forum_id": forum id
    "category_id": category id
    "created_at": created at
    "updated_at": last modified at
    "ip": IP address
    "agent": browser info
    "response": main response
    "response_user_id": responder id
    "referrer": referrer
    "responsible_id": assigned person id
    "last_action_status": status
    "email": sender email
    "uid": user token
    "spam_kind": spam type
    "answer": answer
    "answered": has answer
    "duplicate_from_id": duplicate id
    "abstract": abstract
    "status_id": status id
    "view_count": view count
    "tags": tags
    "facebook_likes": Facebook likes count
    "min_votes_to_start": votes needed to start
    "use_html": is HTML
    "email_to": email to
    "email_cc": email cc
    "email_bcc": email bcc
    "spam_score": spam score
    "spam_report": spam info
    "closed": is closed (true/false)
    "scheduled_at": scheduled date
    "task_kind": task type (feedback, email, task, help, chat, phone, lead, error, idea)
    "priority": priority
    "title_note": null
    "user_spam_report": spam report
    "client_id": client id
    "project_id": project id
    "help_link": help link key
    "help_content": help content
    "post_id": parent post id
    "www": poster website
    "private": is private (true/false)
    "unread": is unread (true/false)
    "email_recipient": recipient (helpdesk/mail)
    "email_reply_to": reply to (helpdesk/mail)
}
```