Skip to content

Categories

System categories are readable for everyone. Write routes apply to custom categories and upsert is best when a source system owns the external identity.

`POST` and `PATCH` requests require an Idempotency-Key header. Responses return an X-Request-Id header plus X-RateLimit-* headers, and errors follow application/problem+json.

GET /v1/categories

List categories

Example

curl -X GET "https://api.duitmyself.app/v1/categories" \
  -H "Authorization: Bearer key_..." \

Response schema · CategoryListResponse

{
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Category"
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "hasMore": {
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "nextCursor",
    "hasMore"
  ]
}
POST /v1/categories

Create a custom category

Example

curl -X POST "https://api.duitmyself.app/v1/categories" \
  -H "Authorization: Bearer key_..." \
  -H "Idempotency-Key: demo-post" \
  -H "Content-Type: application/json" \
  -d '"CategoryCreate"'

Request schema · CategoryCreate

{
  "$ref": "#/definitions/CategoryCreate",
  "definitions": {
    "CategoryCreate": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "icon": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "expense",
            "income"
          ]
        },
        "parentId": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    }
  }
}

Response schema · CategoryResponse

{
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/components/schemas/Category"
    }
  },
  "required": [
    "data"
  ]
}
GET /v1/categories/{categoryId}

Get a category

Parameters

  • categoryId in path

Example

curl -X GET "https://api.duitmyself.app/v1/categories/{categoryId}" \
  -H "Authorization: Bearer key_..." \

Response schema · CategoryResponse

{
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/components/schemas/Category"
    }
  },
  "required": [
    "data"
  ]
}
PATCH /v1/categories/{categoryId}

Update a custom category

Parameters

  • categoryId in path

Example

curl -X PATCH "https://api.duitmyself.app/v1/categories/{categoryId}" \
  -H "Authorization: Bearer key_..." \
  -H "Idempotency-Key: demo-patch" \
  -H "Content-Type: application/json" \
  -d '"CategoryUpdate"'

Request schema · CategoryUpdate

{
  "$ref": "#/definitions/CategoryUpdate",
  "definitions": {
    "CategoryUpdate": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string",
          "nullable": true
        },
        "name": {
          "type": "string"
        },
        "icon": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "expense",
            "income"
          ]
        },
        "parentId": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}

Response schema · CategoryResponse

{
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/components/schemas/Category"
    }
  },
  "required": [
    "data"
  ]
}
DELETE /v1/categories/{categoryId}

Archive a custom category

Parameters

  • categoryId in path

Example

curl -X DELETE "https://api.duitmyself.app/v1/categories/{categoryId}" \
  -H "Authorization: Bearer key_..." \
POST /v1/categories/upsert

Create or update a custom category by external ID

Example

curl -X POST "https://api.duitmyself.app/v1/categories/upsert" \
  -H "Authorization: Bearer key_..." \
  -H "Idempotency-Key: demo-post" \
  -H "Content-Type: application/json" \
  -d '"CategoryUpsert"'

Request schema · CategoryUpsert

{
  "$ref": "#/definitions/CategoryUpsert",
  "definitions": {
    "CategoryUpsert": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "icon": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "expense",
            "income"
          ]
        },
        "parentId": {
          "type": "string"
        }
      },
      "required": [
        "externalId",
        "name"
      ],
      "additionalProperties": false
    }
  }
}

Response schema · CategoryUpsertResponse

{
  "type": "object",
  "properties": {
    "operation": {
      "type": "string",
      "enum": [
        "created",
        "updated"
      ]
    },
    "data": {
      "$ref": "#/components/schemas/Category"
    }
  },
  "required": [
    "operation",
    "data"
  ]
}