# Assets

Assets can be any type of resource critical to your platform matchmaking: cars, skills, goods, real estate, profiles, documents…

When using Stelace, you’ll most probably Search and update Assets, create related Events or Transactions.

Creating your first Asset is very straightforward. Using stelace.js:

const stelace = require('stelace').createInstance({
  apiKey: 'seck_test_rylx3ebUg0bNs1HkJKlqNHkI'
})

await stelace.assets.create({
  name: 'Delorean DMC-12',
  description: 'Fasten your seat belt.'
})

or using curl:

curl https://api.stelace.com/assets \
  -u seck_test_rylx3ebUg0bNs1HkJKlqNHkI: \
  -d name="Delorean DMC-12" \
  -d price=30

This may look too simple. Actually your Assets can have many other attributes, including any of your Custom Attributes, enabling powerful Search.

Asset price is optional and useful for Transactions, depending on its Asset Type.

# ownerId

# Stelace User id

When one of your authenticated Users creates an Asset, ownerId will automatically be set to this User id, unless you set it to null or empty string.

You can also pass any ownerId with permission asset:create:all API, granted to your secret API key by default, which allows you to create Assets on behalf of your Users.

# External id

You can also set optional ownerId to any value you use internally:

await stelace.assets.create({
  name: 'Delorean DMC-12',
  ownerId: 'emmet-doc-brown'
})

This can be useful for simple filtering:

await stelace.assets.list({
  ownerId: 'emmet-doc-brown'
})