# Store a new recurring transaction

`POST /v1/recurrences`

Creates a new recurring transaction. The data required can be submitted as a JSON body or as a list of parameters.

Authentication (security requirement alternatives):

```json
[
  {
    "firefly_iii_auth": []
  },
  {
    "local_bearer_auth": []
  }
]
```

- firefly_iii_auth: oauth2. OAuth2 authorization code flow. Create a client on your installation's `/profile` page; it authorizes at `/oauth/authorize` and issues tokens at `/oauth/token` there. The URLs below are the demo site's. [How to use the API](https://sourcey-firefly.pages.dev/how-to/firefly-iii/features/api/index.md) walks through it.
- local_bearer_auth: http (bearer). A Personal Access Token, sent as a bearer token. Create one on your installation under Options > Profile > OAuth > Personal Access Tokens.

Parameters:

- `X-Trace-Id` (header, string, uuid, optional) - Unique identifier associated with this request.
  Type: string, uuid
  
  Example:
  
  ```json
  "40c71bbb-c676-4f24-83cf-cc725d7d7a00"
  ```

Request body: application/json (required)

JSON array or key=value pairs with the necessary recurring transaction information. See the model for the exact specifications.

Type: object

Schema: [RecurrenceStore](https://sourcey-firefly.pages.dev/api/models/recurrencestore/index.md)

- `type` (required)
  Reference: [RecurrenceTransactionType](https://sourcey-firefly.pages.dev/api/models/recurrencetransactiontype/index.md); Type: string, string
  
  enum: ["withdrawal","transfer","deposit"]
  
  Example:
  
  ```json
  "withdrawal"
  ```

- `title` (required)
  Type: string, string
  
  Example:
  
  ```json
  "Rent"
  ```

- `description` (optional)
  Type: string, string
  
  Not to be confused with the description of the actual transaction(s) being created.
  
  Example:
  
  ```json
  "Recurring transaction for the monthly rent"
  ```

- `first_date` (required)
  Type: string, date
  
  First time the recurring transaction will fire. Must be after today.
  
  Example:
  
  ```json
  "2026-10-31"
  ```

- `repeat_until` (required)
  Type: string, date; nullable
  
  Date until the recurring transaction can fire. Use either this field or repetitions.
  
  Example:
  
  ```json
  "2026-10-31"
  ```

- `nr_of_repetitions` (optional)
  Type: integer, int32; nullable
  
  Max number of created transactions. Use either this field or repeat_until.
  
  Example:
  
  ```json
  5
  ```

- `apply_rules` (optional)
  Type: boolean
  
  Whether or not to fire the rules after the creation of a transaction.
  
  Example:
  
  ```json
  true
  ```

- `active` (optional)
  Type: boolean
  
  If the recurrence is even active.
  
  Example:
  
  ```json
  true
  ```

- `notes` (optional)
  Type: string, string; nullable
  
  Example:
  
  ```json
  "Some notes"
  ```

- `repetitions` (required)
  Type: array
  
  Items:
    Reference: [RecurrenceRepetitionStore](https://sourcey-firefly.pages.dev/api/models/recurrencerepetitionstore/index.md); Type: object

- `transactions` (required)
  Type: array
  
  Items:
    Reference: [RecurrenceTransactionStore](https://sourcey-firefly.pages.dev/api/models/recurrencetransactionstore/index.md); Type: object

Request body: application/x-www-form-urlencoded (required)

JSON array or key=value pairs with the necessary recurring transaction information. See the model for the exact specifications.

Type: object

Schema: [RecurrenceStore](https://sourcey-firefly.pages.dev/api/models/recurrencestore/index.md)

- `type` (required)
  Reference: [RecurrenceTransactionType](https://sourcey-firefly.pages.dev/api/models/recurrencetransactiontype/index.md); Type: string, string
  
  enum: ["withdrawal","transfer","deposit"]
  
  Example:
  
  ```json
  "withdrawal"
  ```

- `title` (required)
  Type: string, string
  
  Example:
  
  ```json
  "Rent"
  ```

- `description` (optional)
  Type: string, string
  
  Not to be confused with the description of the actual transaction(s) being created.
  
  Example:
  
  ```json
  "Recurring transaction for the monthly rent"
  ```

- `first_date` (required)
  Type: string, date
  
  First time the recurring transaction will fire. Must be after today.
  
  Example:
  
  ```json
  "2026-10-31"
  ```

- `repeat_until` (required)
  Type: string, date; nullable
  
  Date until the recurring transaction can fire. Use either this field or repetitions.
  
  Example:
  
  ```json
  "2026-10-31"
  ```

- `nr_of_repetitions` (optional)
  Type: integer, int32; nullable
  
  Max number of created transactions. Use either this field or repeat_until.
  
  Example:
  
  ```json
  5
  ```

- `apply_rules` (optional)
  Type: boolean
  
  Whether or not to fire the rules after the creation of a transaction.
  
  Example:
  
  ```json
  true
  ```

- `active` (optional)
  Type: boolean
  
  If the recurrence is even active.
  
  Example:
  
  ```json
  true
  ```

- `notes` (optional)
  Type: string, string; nullable
  
  Example:
  
  ```json
  "Some notes"
  ```

- `repetitions` (required)
  Type: array
  
  Items:
    Reference: [RecurrenceRepetitionStore](https://sourcey-firefly.pages.dev/api/models/recurrencerepetitionstore/index.md); Type: object

- `transactions` (required)
  Type: array
  
  Items:
    Reference: [RecurrenceTransactionStore](https://sourcey-firefly.pages.dev/api/models/recurrencetransactionstore/index.md); Type: object

Responses:

- 200: New recurring transaction stored, result in response.

Content type: application/vnd.api+json

Type: object

Schema: [RecurrenceSingle](https://sourcey-firefly.pages.dev/api/models/recurrencesingle/index.md)

- `data` (required)
  Reference: [RecurrenceRead](https://sourcey-firefly.pages.dev/api/models/recurrenceread/index.md); Type: object

- 400: Bad request

Content type: application/json

Type: object

Schema: [BadRequestResponse](https://sourcey-firefly.pages.dev/api/models/badrequestresponse/index.md)

- `message` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "Bad Request"
  ```

- `exception` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "BadRequestHttpException"
  ```

- 401: Unauthenticated

Content type: application/json

Type: object

Schema: [UnauthenticatedResponse](https://sourcey-firefly.pages.dev/api/models/unauthenticatedresponse/index.md)

- `message` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "Unauthenticated"
  ```

- `exception` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "AuthenticationException"
  ```

- 404: Page not found

Content type: application/json

Type: object

Schema: [NotFoundResponse](https://sourcey-firefly.pages.dev/api/models/notfoundresponse/index.md)

- `message` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "Resource not found"
  ```

- `exception` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "NotFoundHttpException"
  ```

- 422: Validation error. The body will have the exact details.

Content type: application/json

Type: object

Schema: [ValidationErrorResponse](https://sourcey-firefly.pages.dev/api/models/validationerrorresponse/index.md)

- `message` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "The given data was invalid."
  ```

- `errors` (optional)
  Type: object
  
  - `email` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `force` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `blocked` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `field` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `role` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `blocked_code` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `name` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `type` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `iban` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `start` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `end` (optional)
    Type: array
    
    Items:
      Type: string, string
  
  - `date` (optional)
    Type: array
    
    Items:
      Type: string, string

- 500: Internal exception

Content type: application/json

Type: object

Schema: [InternalExceptionResponse](https://sourcey-firefly.pages.dev/api/models/internalexceptionresponse/index.md)

- `message` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "Internal Exception"
  ```

- `exception` (optional)
  Type: string, string
  
  Example:
  
  ```json
  "InternalException"
  ```

## Examples

### cURL

```bash
curl -X POST 'https://firefly.example.com/api/v1/recurrences' \
  -H 'X-Trace-Id: 40c71bbb-c676-4f24-83cf-cc725d7d7a00' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "type": "withdrawal",
  "title": "Rent",
  "description": "Recurring transaction for the monthly rent",
  "first_date": "2026-10-31",
  "repeat_until": "2026-10-31",
  "nr_of_repetitions": 5,
  "apply_rules": true,
  "active": true,
  "notes": "Some notes",
  "repetitions": [
    {
      "type": "weekly",
      "moment": "3",
      "skip": 0,
      "weekend": 1
    }
  ],
  "transactions": [
    {
      "description": "Rent for the current month",
      "amount": "123.45",
      "foreign_amount": "123.45",
      "currency_id": "3",
      "currency_code": "EUR",
      "foreign_currency_id": "17",
      "foreign_currency_code": "GBP",
      "budget_id": "4",
      "category_id": "211",
      "source_id": "913",
      "destination_id": "258",
      "tags": null,
      "piggy_bank_id": "123",
      "bill_id": "123"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "type": "withdrawal",
  "title": "Rent",
  "description": "Recurring transaction for the monthly rent",
  "first_date": "2026-10-31",
  "repeat_until": "2026-10-31",
  "nr_of_repetitions": 5,
  "apply_rules": true,
  "active": true,
  "notes": "Some notes",
  "repetitions": [
    {
      "type": "weekly",
      "moment": "3",
      "skip": 0,
      "weekend": 1
    }
  ],
  "transactions": [
    {
      "description": "Rent for the current month",
      "amount": "123.45",
      "foreign_amount": "123.45",
      "currency_id": "3",
      "currency_code": "EUR",
      "foreign_currency_id": "17",
      "foreign_currency_code": "GBP",
      "budget_id": "4",
      "category_id": "211",
      "source_id": "913",
      "destination_id": "258",
      "tags": null,
      "piggy_bank_id": "123",
      "bill_id": "123"
    }
  ]
}`;

const response = await fetch('https://firefly.example.com/api/v1/recurrences', {
  method: 'POST',
  headers: {
    'X-Trace-Id': '40c71bbb-c676-4f24-83cf-cc725d7d7a00',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "type": "withdrawal",
  "title": "Rent",
  "description": "Recurring transaction for the monthly rent",
  "first_date": "2026-10-31",
  "repeat_until": "2026-10-31",
  "nr_of_repetitions": 5,
  "apply_rules": true,
  "active": true,
  "notes": "Some notes",
  "repetitions": [
    {
      "type": "weekly",
      "moment": "3",
      "skip": 0,
      "weekend": 1
    }
  ],
  "transactions": [
    {
      "description": "Rent for the current month",
      "amount": "123.45",
      "foreign_amount": "123.45",
      "currency_id": "3",
      "currency_code": "EUR",
      "foreign_currency_id": "17",
      "foreign_currency_code": "GBP",
      "budget_id": "4",
      "category_id": "211",
      "source_id": "913",
      "destination_id": "258",
      "tags": null,
      "piggy_bank_id": "123",
      "bill_id": "123"
    }
  ]
}'''

response = requests.post(
    'https://firefly.example.com/api/v1/recurrences',
    data=body.encode('utf-8'),
    headers={
        'X-Trace-Id': '40c71bbb-c676-4f24-83cf-cc725d7d7a00',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
