# Split Profile

The Split Profile resource is used to configure the behavior of split operations.

### The Split Profile object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the split profile. |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `delay` | INTEGER | Time in milliseconds the amount stays at the workspace. |
| `interval` | STRING | Frequency of transfer. Options: "instant", "day", "week", "month". |
| `status` | STRING | Current split profile status. |
| `tags` | LIST OF STRINGS | Tags associated with the split profile. |
| `updated` | STRING | Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00". |

### Put a Split Profile

`PUT /v2/split-profile`

Send a list containing a single Split Profile object. If the object has already been created, its rules will be updated.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `interval` | REQUIRED | Frequency of the profile's transfer. No default; must be provided. Options: "instant", "day", "week", "month" |
| `delay` | OPTIONAL | How long the amount will stay at the workspace before being transferred, in milliseconds. Must be between 0 and 1000000000. Default is 0 |
| `tags` | OPTIONAL | List of strings for reference when searching for profiles. ex: ["test profile"] |

**Request**

```python
import starkbank

payload ={
    "interval": "day",
    "delay": 0
}
splitprofile = starkbank.splitprofile.update([payload])

for profile in splitprofile:
  print(profile)
```

**Response**

```python
SplitProfile(
  created=2023-10-24 00:23:08.831127,
  delay=0,
  id=6206954716266496,
  interval=day,
  status=created,
  tags=[],
  updated=2024-02-26 17:56:13.304200
)
```

### List Split Profiles

`GET /v2/split-profile`

Get a list of Split Profiles in chunks of up to 100. If you need smaller chunks, use the limit parameter.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `status` | OPTIONAL | Filter split profiles by the specified status. |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |

**Request**

```python
import starkbank

splitprofiles = starkbank.splitprofile.query(limit=2)

for profile in splitprofiles:
    print(profile)
```

**Response**

```python
SplitProfile(
    created=2023-10-24 00:23:08.831127,
    delay=0,
    id=6206954716266496,
    interval=day,
    status=created,
    tags=[],
    updated=2024-02-26 17:56:13.539948
)
```

### Get a Split Profile

`GET /v2/split-profile/:id`

Retrieve a single Split Profile object by its ID, which was previously created.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the Split Profile entity |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

splitprofile = starkbank.splitprofile.get(5634161670881280)

print(splitprofile)
```

**Response**

```python
SplitProfile(
  created=2023-10-24 00:23:08.831127,
  delay=0,
  id=6206954716266496,
  interval=day,
  status=created,
  tags=[],
  updated=2024-02-26 17:56:13.539948
)
```

### List Split Profile Logs

`GET /v2/split-profile/log`

Get a paged list of Split Profile logs. A log tracks a change in the Split Profile entity according to its life cycle.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `profileIds` | OPTIONAL | List of Split Profile ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']. |
| `types` | OPTIONAL | filter retrieved objects by event types. ex: 'processing' or 'success' |

**Request**

```python
import starkbank

logs = starkbank.splitprofile.log.query(limit=10)

for log in logs:
  print(log)
```

**Response**

```python
Log(
  created=2024-02-26 17:56:13.326078,
  errors=None,
  id=5746640992337920,
  profile=SplitProfile(
    created=2023-10-24 00:23:08.831127,
    delay=0,
    id=6206954716266496,
    interval=day,
    status=created,
    tags=[],
    updated=2024-02-26 17:56:13.581938
  ),
  type=updated
)
```

### Get a Split Profile Log

`GET /v2/split-profile/log/:id`

Get a single Split Profile Log by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the log entity. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

log = starkbank.splitprofile.log.get("5634161670881280")

print(log)
```

**Response**

```python
Log(
  created=2024-02-26 17:56:13.326078,
  errors=None,
  id=5746640992337920,
  profile=SplitProfile(
    created=2023-10-24 00:23:08.831127,
    delay=0,
    id=6206954716266496,
    interval=day,
    status=created,
    tags=[],
    updated=2024-02-26 17:56:13.581938
  ),
  type=updated
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/split-profile-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/split-profile-node.md)
- [PHP](https://docs.starkbank.com/api/v2/split-profile-php.md)
- [Java](https://docs.starkbank.com/api/v2/split-profile-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/split-profile-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/split-profile-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/split-profile-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/split-profile-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/split-profile-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/split-profile-curl.md)
