Entry

Entries are notes and emails associated with your parties, projects and opportunities. For a full description of the model see the Entry model definition.

List entries

List notes, emails and completed tasks for parties, kases (projects) and opportunities. The entity parameter in the URL determines which entry type to list and must be one of parties, opportunities or kases (projects). entityId should be the id of a party, project or opportunity on the account.

GET
https://api.capsulecrm.com/api/v2/{entity}/{entityId}/entries

Query Parameters

Name Type Description
page Integer

The page of results to return. Default: 1

perPage Integer

The number of entities to return per page. Value must be between 1 and 50. Default: 50

embed Array of String

Can be used to request additional data that aren’t included in the response by default. If provided, should be a comma separated list of strings. Supported values for this endpoint are party (the party associated with the entry), kase (the project the entry is on), opportunity (the opportunity the entry is on), creator (the creator of the entry) and activityType (the type of the entry). Read more about embed.

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property entries which is an array of Entry objects. In the case of an invalid request, an error message will be returned, as described in the errors section.

HTTP/1.1 200
Link: <https://api.capsulecrm.com/api/v2/entries?page=2>; rel="next"
{
  "entries" : [ {
    "id" : 12,
    "type" : "task",
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -4,
      "name" : "Task completed"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "test",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }, {
    "id" : 11,
    "type" : "note",
    "attachments" : [ {
      "id" : 4,
      "filename" : "works of William Shakespeare.pdf",
      "contentType" : "application/pdf",
      "size" : 5557452
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -1,
      "name" : "Note"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "Shall I compare thee to a summer's day?",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }, {
    "id" : 10,
    "type" : "email",
    "attachments" : [ {
      "id" : 2,
      "filename" : "photo 1.JPG",
      "contentType" : "image/jpeg",
      "size" : 107307
    } ],
    "parties" : [ {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -5,
      "name" : "Email sent"
    },
    "subject" : "Fwd: Development Notes",
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
    "entryAt" : "2015-12-07T16:54:27Z",
    "participants" : [ {
      "id" : 43360750,
      "address" : "hello@zestia.com",
      "name" : "Hello",
      "role" : "FROM"
    }, {
      "id" : 43360751,
      "address" : "support@capsulecrm.com",
      "name" : "Support",
      "role" : "TO"
    } ]
  } ]
}

Headers:

Name Type Description
Link String

Links to the next and previous pages, encoded as defined in RFC 5988.

List by date

List notes, emails and the details of completed party tasks in descending order starting with the most recent entry date first.

GET
https://api.capsulecrm.com/api/v2/entries

Query Parameters

Name Type Description
page Integer

The page of results to return. Default: 1

perPage Integer

The number of entities to return per page. Value must be between 1 and 100. Default: 50

embed Array of String

Can be used to request additional data that aren’t included in the response by default. If provided, should be a comma separated list of strings. Supported values for this endpoint are party (the party associated with the entry), kase (the project the entry is on), opportunity (the opportunity the entry is on), creator (the creator of the entry) and activityType (the type of the entry). Read more about embed.

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property entries which is an array of Entry objects. In the case of an invalid request, an error message will be returned, as described in the errors section.

HTTP/1.1 200
Link: <https://api.capsulecrm.com/api/v2/entries?page=2>; rel="next"
{
  "entries" : [ {
    "id" : 12,
    "type" : "task",
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -4,
      "name" : "Task completed"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "test",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }, {
    "id" : 11,
    "type" : "note",
    "attachments" : [ {
      "id" : 4,
      "filename" : "works of William Shakespeare.pdf",
      "contentType" : "application/pdf",
      "size" : 5557452
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -1,
      "name" : "Note"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "Shall I compare thee to a summer's day?",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }, {
    "id" : 10,
    "type" : "email",
    "attachments" : [ {
      "id" : 2,
      "filename" : "photo 1.JPG",
      "contentType" : "image/jpeg",
      "size" : 107307
    } ],
    "parties" : [ {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -5,
      "name" : "Email sent"
    },
    "subject" : "Fwd: Development Notes",
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
    "entryAt" : "2015-12-07T16:54:27Z",
    "participants" : [ {
      "id" : 43360750,
      "address" : "hello@zestia.com",
      "name" : "Hello",
      "role" : "FROM"
    }, {
      "id" : 43360751,
      "address" : "support@capsulecrm.com",
      "name" : "Support",
      "role" : "TO"
    } ]
  } ]
}

Headers:

Name Type Description
Link String

Links to the next and previous pages, encoded as defined in RFC 5988.

Show entry

Show a specific note, email or the details of a completed party task.

GET
https://api.capsulecrm.com/api/v2/entries/{id}

Query Parameters

Name Type Description
embed Array of String

Can be used to request additional data that aren’t included in the response by default. If provided, should be a comma separated list of strings. Supported values for this endpoint are party (the party associated with the entry), kase (the project the entry is on), opportunity (the opportunity the entry is on), creator (the creator of the entry) and activityType (the type of the entry). Read more about embed.

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property entry which will contain an Entry object.

HTTP/1.1 200
{
  "entry" : {
    "id" : 101,
    "type" : "note",
    "attachments" : [ {
      "id" : 1,
      "filename" : "report-12345.pdf",
      "contentType" : "application/pdf",
      "size" : "76542"
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -1,
      "name" : "Note"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "The quick brown fox\njumped over the lazy dog",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }
}

Create entry

Creates a new entry. The body must contain an object with a single property entry which must be an Entry object. The note needs to be created for a party, project or opportunity, so exactly one of these needs to be included in the body of the request.

This endpoint can only be used for creating notes; the type property must be set to note (currently the only accepted option).

To apply changes to entities in attachments you can do the following:

  • To add a new entity: create an entity without an id and token from a previous call to the Upload Attachment endpoint.

POST
https://api.capsulecrm.com/api/v2/entries
          {
  "entry" : {
    "attachments" : [ {
      "token" : "u1/e0/c8a5a36b-972c-405e-89ca-9a2a5c9ff192/1ba87cc2f6b2f7918ba7e467791eed6d/1e30171c70acf05e4d8b5fb4e0c94a8d"
    } ],
    "party" : {
      "id" : 892
    },
    "activityType" : -1,
    "type" : "note",
    "content" : "The quick brown fox\njumped over the lazy dog"
  }
}
        

Response

Returns HTTP status code 201. The body of the response will contain the entry as it was stored in Capsule.

HTTP/1.1 201
Location: https://api.capsulecrm.com/api/v2/entries/101
{
  "entry" : {
    "id" : 101,
    "type" : "note",
    "attachments" : [ {
      "id" : 1,
      "filename" : "report-12345.pdf",
      "contentType" : "application/pdf",
      "size" : "76542"
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -1,
      "name" : "Note"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "The quick brown fox\njumped over the lazy dog",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }
}

Headers:

Name Type Description
Location String

The URL that identifies the new party.

Update entry

Update the content of notes and emails. The body must contain an object with a single property entry which must be an Entry object. This endpoint can only be applied to entries of type email or note.

To apply changes to entities in attachments you can do the following:

  • To add a new entity: create an entity without an id, and add the token from a previous call to the Upload Attachment endpoint.
  • To delete an existing entity: include the id and the following JSON attribute "_delete": true .

If you're removing the last attachment from an entry without content it will result in a validation error as you cannot have an entry with no content and no attachments. You should just use the Delete Entry endpoint instead.

PUT
https://api.capsulecrm.com/api/v2/entries/{id}
          {
  "entry" : {
    "content" : "The quick brown fox\njumped over the lazy dog",
    "attachments" : [ {
      "id" : 2,
      "_delete" : true
    } ]
  }
}
        

Response

Returns HTTP status code 200. The body of the response will contain the entry as it was stored in Capsule.

HTTP/1.1 200
{
  "entry" : {
    "id" : 101,
    "type" : "note",
    "attachments" : [ {
      "id" : 1,
      "filename" : "report-12345.pdf",
      "contentType" : "application/pdf",
      "size" : "76542"
    } ],
    "creator" : {
      "id" : 61,
      "username" : "ted",
      "name" : "Ted Danson"
    },
    "activityType" : {
      "id" : -1,
      "name" : "Note"
    },
    "createdAt" : "2015-12-07T16:54:27Z",
    "updatedAt" : "2015-12-07T16:54:27Z",
    "content" : "The quick brown fox\njumped over the lazy dog",
    "entryAt" : "2015-12-07T16:54:27Z",
    "party" : {
      "id" : 892,
      "type" : "organisation",
      "name" : "Zestia",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    }
  }
}

Delete entry

Remove an entry from the Capsule account and any associated attachments.

DELETE
https://api.capsulecrm.com/api/v2/entries/{id}

Response

Returns HTTP status code 204. Returns status code 204 with an empty body if the entry was successfully deleted. In some cases Capsule might schedule the deletion for later and return HTTP status 202 Accepted as defined in Long Running Operation section.

HTTP/1.1 204

Upload attachment

Upload an attachment ready to be attached to an entry.

The following request headers are required.

  • Content-Type - should be set to the MIME type of the file being uploaded.
  • Content-Length - should be set to the length of the file being uploaded in bytes.
  • X-Attachment-Filename - should be set to a URL encoded name of the file being uploaded.

The contents of the file being uploaded should be submitted as the body of the request.

POST
https://api.capsulecrm.com/api/v2/attachments/upload

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property upload which will contain a token property.

The token can be used when creating and updating entries, to associate the attachment with that entry. Add a new Attachment to the attachments array, with the token set to this token value.

HTTP/1.1 200
{
  "upload" : {
    "token" : "u1/e0/c8a5a36b-972c-405e-89ca-9a2a5c9ff192/1ba87cc2f6b2f7918ba7e467791eed6d/1e30171c70acf05e4d8b5fb4e0c94a8d"
  }
}

Show attachment

Get the contents of an attachment. The contents can be saved locally to a file using the Content-disposition header to determine the file name.

GET
https://api.capsulecrm.com/api/v2/attachments/{attachmentId}

Response

Returns HTTP status code 200. The contents of the file being requested will be the body of the response.

HTTP/1.1 200
Content-disposition: inline; filename*=UTF-8''report-18273.pdf; filename="report-18273.pdf"

Headers:

Name Type Description
Content-disposition String

Contains the filename that can be used when saving the attachment locally.