Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- IndividualAccountAttachment resource
### Changed
- IndividualAccountRequest address as structured object

## [0.18.0] - 2026-05-04
### Added
Expand Down
122 changes: 79 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ This SDK version is compatible with the Stark Infra API v2.
- [IndividualIdentity](#create-individualidentities): Create individual identities
- [IndividualDocument](#create-individualdocuments): Create individual documents
- [IndividualAccountRequest](#create-individualaccountrequest): Create individual account requests
- [AccountRequestAttachment](#create-accountrequestattachment): Create account request attachments
- [IndividualAccountAttachment](#create-individualaccountattachments): Create individual account attachments
- [Webhook](#webhook):
- [Webhook](#create-a-webhook-subscription): Configure your webhook endpoints and subscriptions
- [WebhookEvents](#process-webhook-events): Manage Webhook events
Expand Down Expand Up @@ -3185,8 +3185,15 @@ await (async() => {
let accounts = await starkinfra.individualAccountRequest.create([
new starkinfra.IndividualAccountRequest({
name: "Tony Stark",
taxId: "634.906.770-30",
address: "R. pamplona, 4321",
taxId: "012.345.678-90",
address: {
street: "Av. Faria Lima",
number: "4321",
neighborhood: "Itaim Bibi",
city: "Sao Paulo",
state: "SP",
zipCode: "04538133"
},
income: 50000
})
]);
Expand Down Expand Up @@ -3244,7 +3251,7 @@ await (async() => {
})();
```

**Note**: Before sending your individual account request to validation by patching its status, you must send all the required documents using the create method of the AccountRequestAttachment resource.
**Note**: Before sending your individual account request to validation by patching its status, you must send all the required documents using the create method of the IndividualAccountAttachment resource.

### Query IndividualAccountRequest logs

Expand Down Expand Up @@ -3276,81 +3283,110 @@ await (async() => {
})();
```

### Create AccountRequestAttachment
### Create IndividualAccountAttachments

You can create an account request attachment to attach images of documents to a specific individual account request.
You must reference the desired account request by its id.
You can create an individual account attachment to attach images of documents to a specific individual account request.
You must reference the desired account request by its id. Pass the raw image bytes plus a MIME content type and the SDK
encodes them as a `data:` URL client-side before sending.

```javascript
const fs = require('fs');

await (async() => {
let attachments = await starkinfra.accountRequestAttachment.create([
new starkinfra.AccountRequestAttachment({
let attachments = await starkinfra.individualAccountAttachment.create([
new starkinfra.IndividualAccountAttachment({
'type': "identity-front",
'content': "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD...",
'accountRequestId': '5155165527080960',
'tags': ["breaking", "bad"]
})
]);

console.log(attachments[0]);

attachments = await starkinfra.accountRequestAttachment.create([
new starkinfra.AccountRequestAttachment({
'type': "identity-back",
'content': "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD...",
'accountRequestId': '5155165527080960',
'tags': ["breaking", "bad"]
})
]);

console.log(attachments[0]);

attachments = await starkinfra.accountRequestAttachment.create([
new starkinfra.AccountRequestAttachment({
'type': "selfie",
'content': "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD...",
'content': fs.readFileSync('identity-front.png'),
'contentType': "image/png",
'accountRequestId': '5155165527080960',
'tags': ["breaking", "bad"]
})
]);

console.log(attachments[0]);
for (let attachment of attachments) {
console.log(attachment);
}
})();
```

**Note**: Instead of using AccountRequestAttachment objects, you can also pass each element in dictionary format
**Note**: Instead of using IndividualAccountAttachment objects, you can also pass each element in dictionary format

### Query AccountRequestAttachments
### Query IndividualAccountAttachments

You can query multiple account request attachments according to filters.
You can query multiple individual account attachments according to filters.

```javascript
await (async() => {
let attachments = await starkinfra.accountRequestAttachment.query({
let attachments = await starkinfra.individualAccountAttachment.query({
'limit': 10,
'after': '2022-01-01',
'before': '2022-03-01',
'status': "success",
'tags': ["breaking", "bad"],
'ids': ["5656565656565656"]
});
for await (let attachment of attachment) {

for await (let attachment of attachments) {
console.log(attachment);
}
})();
```

### Get an AccountRequestAttachment
### Get an IndividualAccountAttachment

After its creation, information on an account request attachment may be retrieved by its id.
After its creation, information on an individual account attachment may be retrieved by its id.

```javascript
await (async() => {
let attachment = await starkinfra.accountRequestAttachment.get('5155165527080960');

let attachment = await starkinfra.individualAccountAttachment.get('5155165527080960');

console.log(attachment);
})();
```

### Cancel an IndividualAccountAttachment

You can also cancel an individual account attachment by its id.

```javascript
await (async() => {
let attachment = await starkinfra.individualAccountAttachment.cancel('5155165527080960');

console.log(attachment);
})();
```

### Query IndividualAccountAttachment logs

You can query individual account attachment logs to better understand attachment life cycles.

```javascript
await (async() => {
let logs = await starkinfra.individualAccountAttachment.log.query({
'limit': 50,
'after': '2022-01-01',
'before': '2022-01-20',
'attachmentIds': ["5656565656565656"]
});

for await (let log of logs) {
console.log(log);
}
})();
```

### Get an IndividualAccountAttachment log

You can also get a specific log by its id.

```javascript
await (async() => {
let log = await starkinfra.individualAccountAttachment.log.get('5155165527080960');

console.log(log);
})();
```

## Webhook

### Create a webhook subscription
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports.staticBrcode = require('./sdk/staticBrcode');
exports.brcodePreview = require('./sdk/brcodePreview');
exports.individualIdentity = require('./sdk/individualIdentity');
exports.individualDocument = require('./sdk/individualDocument');
exports.accountRequestAttachment = require('./sdk/accountRequestAttachment');
exports.individualAccountAttachment = require('./sdk/individualAccountAttachment');
exports.individualAccountRequest = require('./sdk/individualAccountRequest');
exports.issuingProduct = require('./sdk/issuingProduct');
exports.issuingCard = require('./sdk/issuingCard');
Expand Down Expand Up @@ -60,7 +60,7 @@ exports.bacenId = require('./sdk/utils/bacenId.js');
exports.returnId = require('./sdk/utils/returnId.js');
exports.endToEndId = require('./sdk/utils/endToEndId.js');
exports.key = require('./sdk/key.js');
exports.error = require('./sdk/error.js');
exports.error = require('./node_modules/starkcore/starkcore/error.js');
exports.request = require('./sdk/request/request.js')


Expand Down Expand Up @@ -88,7 +88,7 @@ exports.BrcodePreview = exports.brcodePreview.BrcodePreview;
exports.IndividualIdentity = exports.individualIdentity.IndividualIdentity;
exports.IndividualDocument = exports.individualDocument.IndividualDocument;
exports.IndividualAccountRequest = exports.individualAccountRequest.IndividualAccountRequest;
exports.AccountRequestAttachment = exports.accountRequestAttachment.AccountRequestAttachment;
exports.IndividualAccountAttachment = exports.individualAccountAttachment.IndividualAccountAttachment;
exports.IssuingProduct = exports.issuingProduct.IssuingProduct;
exports.IssuingCard = exports.issuingCard.IssuingCard;
exports.IssuingRule = exports.issuingRule.IssuingRule;
Expand Down
9 changes: 0 additions & 9 deletions sdk/accountRequestAttachment/index.js

This file was deleted.

10 changes: 10 additions & 0 deletions sdk/individualAccountAttachment/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const individualAccountAttachment = require('./individualAccountAttachment.js');

exports.log = require('./log');
exports.create = individualAccountAttachment.create;
exports.get = individualAccountAttachment.get;
exports.query = individualAccountAttachment.query;
exports.page = individualAccountAttachment.page;
exports.cancel = individualAccountAttachment.cancel;

exports.IndividualAccountAttachment = individualAccountAttachment.IndividualAccountAttachment;
Loading