SyncNote API (1.0.0)

Download OpenAPI specification:

SyncNote のデータを扱うための API です。予定、日記、TODO リスト、メモを読み取れます。予定の作成と更新、TODO の項目の追加と完了、日記への追記、メモの作成と追記もできます。

設定画面の「APIトークン」でアクセストークンを作成し、Authorization: Bearer snk_... ヘッダーで送ってください。トークンをクエリパラメーターで送ったリクエストは拒否されます。

トークンは、作成するときに「読み取りと書き込み」を選ばない限り、読み取り専用です。読み取り専用のトークンで書き込みのリクエストを送ると、403(insufficient_scope)を返します。書き込みのリクエストの本文は、Content-Type: application/json ヘッダーを付けて JSON で送ってください。

回数制限:

  • Free プラン: 1 日 3 回まで使えます(日本時間の 0 時にリセットされます)。成功した応答には X-RateLimit-Remaining ヘッダーが付きます。
  • Pro プラン: 1 日の回数に上限はありません。
  • どちらのプランも、1 分あたり 60 回まで使えます。
  • 読み取りと書き込みは、同じ回数として数えます。

上限に達すると、API は 429 を返します。Retry-After ヘッダーと error.retryAfter に、再試行できるまでの秒数が入ります。

一覧を返すエンドポイントは、結果をページに分けて返します。前の応答の nextCursor を cursor に指定すると、次のページを取得できます。最後のページでは nextCursor が null になります。

期間内の予定の一覧を取得する

期間内に始まる予定と、start より前に始まり start 以降に終わる複数日の予定を返します。

繰り返し予定は、期間内の日付ごとに 1 件ずつ返します。それぞれに専用の id と date があり、originalId には繰り返し予定の ID が入ります。

開始日の順に並び、開始日が同じ場合は ID の順に並びます。期間は start から 400 日までです。end がそれより後の場合は、400 日までに短縮します。

Authorizations:
bearerAuth
query Parameters
start
required
string <date>

期間の最初の日付です(YYYY-MM-DD)。

end
required
string <date>

期間の最後の日付です(YYYY-MM-DD)。start 以降の日付を指定してください。

limit
integer [ 1 .. 500 ]
Default: 100

1 ページあたりの件数です。

cursor
string

前のページの nextCursor の値です。

Responses

Response samples

Content type
application/json
{
  • "events": [
    ],
  • "count": 0,
  • "nextCursor": "string"
}

予定を作成する

単日または複数日の予定を作成します。繰り返し予定は API から作成できません。

書き込みの権限を持つトークンが必要です。

Authorizations:
bearerAuth
Request Body schema: application/json
required
title
required
string [ 1 .. 200 ] characters

予定のタイトルです。前後の空白は取り除きます。

date
required
string <date>

開始日です(YYYY-MM-DD)。

endDate
string <date>

複数日の予定の終了日です。date より後の日付を指定します。単日の予定では省略します。

startTime
string^([01]\d|2[0-3]):[0-5]\d$

開始時刻です(HH:mm)。終日の予定では省略します。

endTime
string^([01]\d|2[0-3]):[0-5]\d$

終了時刻です(HH:mm)。startTime が必要です。単日の予定では startTime より後の時刻を指定します。

description
string [ 1 .. 5000 ] characters

予定の説明です。前後の空白は取り除きます。

layerId
string^(?!__)[A-Za-z0-9_-]{1,128}$

GET /v1/layers で返るレイヤーの id です。省略すると sys-events になります。

categoryId
string^(?!__)[A-Za-z0-9_-]{1,128}$

GET /v1/categories で返るカテゴリの id です。

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "date": "2019-08-24",
  • "endDate": "2019-08-24",
  • "startTime": "string",
  • "endTime": "string",
  • "description": "string",
  • "layerId": "string",
  • "categoryId": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "originalId": "string",
  • "date": "2019-08-24",
  • "endDate": "2019-08-24",
  • "repeat": {
    },
  • "title": "string",
  • "description": "string",
  • "startTime": "string",
  • "endTime": "string",
  • "layerId": "string",
  • "categoryId": "string",
  • "createdAt": "string",
  • "updatedAt": "string"
}

予定を更新する

本文に入れた項目だけを変更します。endDate、startTime、endTime は、null を送ると削除できます。日付と時刻の規則は、変更後の予定に対して確かめます。

description は API から変更できません。誤った更新で既存の文章が失われないようにするためです。

繰り返し予定は API から更新できません。繰り返し予定へのリクエストには 400 を返します。

書き込みの権限を持つトークンが必要です。

Authorizations:
bearerAuth
path Parameters
eventId
required
string^(?!__)[A-Za-z0-9_-]{1,128}$

予定の ID(GET /v1/events で返る予定の id)です。繰り返し予定の各回の ID は指定できず、404 を返します。

Request Body schema: application/json
required
non-empty
title
string [ 1 .. 200 ] characters

予定のタイトルです。前後の空白は取り除きます。

date
string <date>

開始日です(YYYY-MM-DD)。

endDate
string or null <date>

複数日の予定の終了日です。date より後の日付を指定します。null を送ると単日の予定になります。

startTime
string or null^([01]\d|2[0-3]):[0-5]\d$

開始時刻です(HH:mm)。null を送ると終日の予定になります。

endTime
string or null^([01]\d|2[0-3]):[0-5]\d$

終了時刻です(HH:mm)。startTime が必要です。単日の予定では startTime より後の時刻を指定します。null を送ると削除します。

layerId
string^(?!__)[A-Za-z0-9_-]{1,128}$

GET /v1/layers で返るレイヤーの id です。

categoryId
string^(?!__)[A-Za-z0-9_-]{1,128}$

GET /v1/categories で返るカテゴリの id です。

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "date": "2019-08-24",
  • "endDate": "2019-08-24",
  • "startTime": "string",
  • "endTime": "string",
  • "layerId": "string",
  • "categoryId": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "originalId": "string",
  • "date": "2019-08-24",
  • "endDate": "2019-08-24",
  • "repeat": {
    },
  • "title": "string",
  • "description": "string",
  • "startTime": "string",
  • "endTime": "string",
  • "layerId": "string",
  • "categoryId": "string",
  • "createdAt": "string",
  • "updatedAt": "string"
}

期間内の日記の一覧を取得する

日付の順に並び、日付が同じ場合は ID の順に並びます。期間は start から 400 日までです。end がそれより後の場合は、400 日までに短縮します。

Authorizations:
bearerAuth
query Parameters
start
required
string <date>

期間の最初の日付です(YYYY-MM-DD)。

end
required
string <date>

期間の最後の日付です(YYYY-MM-DD)。start 以降の日付を指定してください。

limit
integer [ 1 .. 500 ]
Default: 100

1 ページあたりの件数です。

cursor
string

前のページの nextCursor の値です。

Responses

Response samples

Content type
application/json
{
  • "diaries": [
    ],
  • "count": 0,
  • "nextCursor": "string"
}

指定した日の日記に追記する

content を日記の末尾に、改行して追加します。その日の日記がない場合は、新しく作成します。

日記は 100000 文字まで保存できます。追記すると上限を超える場合は 400 を返します。

書き込みできるトークンが必要です。

Authorizations:
bearerAuth
path Parameters
date
required
string <date>

日記の日付(YYYY-MM-DD)

Request Body schema: application/json
required
content
required
string [ 1 .. 5000 ] characters

追記する文章です。

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "date": "2019-08-24",
  • "content": "string",
  • "createdAt": "string",
  • "updatedAt": "string"
}

TODO リストとアイテムの一覧を取得する

リストは ID の順に並び、リスト単位でページに分けます。各リストには、表示順で最大 500 件のアイテムが入ります。それより多い場合は itemsTruncated が true になります。

Authorizations:
bearerAuth
query Parameters
limit
integer [ 1 .. 20 ]
Default: 10

1 ページあたりのリスト数です。

cursor
string

前のページの nextCursor の値です。

Responses

Response samples

Content type
application/json
{
  • "todos": [
    ],
  • "count": 0,
  • "nextCursor": "string"
}

TODO リストに項目を追加する

項目はリストの先頭に、未完了の状態で追加されます。 API からは、1 つのリストに最大 500 件まで追加できます。上限に達したリストへの追加は 400 を返します。

書き込みできるトークンが必要です。

Authorizations:
bearerAuth
path Parameters
listId
required
string^(?!__)[A-Za-z0-9_-]{1,128}$

TODO リストの ID(GET /v1/todos で返るリストの id)

Request Body schema: application/json
required
text
required
string [ 1 .. 500 ] characters

項目の本文です。前後の空白は取り除きます。

isStarred
boolean

項目にスターを付けるかどうかです。省略すると false になります。

Responses

Request samples

Content type
application/json
{
  • "text": "string",
  • "isStarred": true
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "text": "string",
  • "isCompleted": true,
  • "isStarred": true,
  • "order": 0,
  • "createdAt": "string",
  • "updatedAt": "string"
}

TODO の項目を完了または未完了にする

書き込みできるトークンが必要です。

Authorizations:
bearerAuth
path Parameters
listId
required
string^(?!__)[A-Za-z0-9_-]{1,128}$

TODO リストの ID(GET /v1/todos で返るリストの id)

itemId
required
string^(?!__)[A-Za-z0-9_-]{1,128}$

TODO の項目の ID

Request Body schema: application/json
required
isCompleted
required
boolean

完了にする場合は true、未完了にする場合は false を指定します。

Responses

Request samples

Content type
application/json
{
  • "isCompleted": true
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "text": "string",
  • "isCompleted": true,
  • "isStarred": true,
  • "order": 0,
  • "createdAt": "string",
  • "updatedAt": "string"
}

メモの一覧を取得する

メモは ID の順に並びます。

Authorizations:
bearerAuth
query Parameters
limit
integer [ 1 .. 500 ]
Default: 100

1 ページあたりの件数です。

cursor
string

前のページの nextCursor の値です。

Responses

Response samples

Content type
application/json
{
  • "memos": [
    ],
  • "count": 0,
  • "nextCursor": "string"
}

メモを作成する

メモは一覧の先頭に追加されます。メモは 500 件まで持てます。それを超えるリクエストには 400 を返します。

書き込みの権限を持つトークンが必要です。

Authorizations:
bearerAuth
Request Body schema: application/json
required
content
required
string [ 1 .. 5000 ] characters

メモの文章です。

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "content": "string",
  • "order": 0,
  • "createdAt": "string",
  • "updatedAt": "string"
}

メモに文章を追記する

content をメモの末尾に、改行して追加します。メモの既存の文章は、API から置き換えたり削除したりできません。

メモには 100000 文字まで書けます。それを超えるリクエストには 400 を返します。

書き込みの権限を持つトークンが必要です。

Authorizations:
bearerAuth
path Parameters
memoId
required
string^(?!__)[A-Za-z0-9_-]{1,128}$

メモの ID(GET /v1/memos で返るメモの id)

Request Body schema: application/json
required
content
required
string [ 1 .. 5000 ] characters

追記する文章です。

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "content": "string",
  • "order": 0,
  • "createdAt": "string",
  • "updatedAt": "string"
}

予定を入れるレイヤーの一覧を取得する

レイヤーは表示順に並びます。予定の layerId は、この一覧にあるレイヤーの id です。日記と祝日のレイヤーは含みません。

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "layers": [
    ]
}

予定のカテゴリの一覧を取得する

カテゴリは表示順に並びます。予定の categoryId は、この一覧にあるカテゴリの id です。

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "categories": [
    ]
}

プロフィールとプランを取得する

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "uid": "string",
  • "email": "string",
  • "displayName": "string",
  • "plan": {
    },
  • "createdAt": "string"
}