> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# License

> License allows you to manage license terms and tokens within Story.

## License

### Methods

* attach\_license\_terms
* mint\_license\_tokens
* register\_pil\_terms
* register\_non\_com\_social\_remixing\_pil
* register\_commercial\_use\_pil
* register\_commercial\_remix\_pil

### attach\_license\_terms

Attaches license terms to an IP.

| Method                 |
| ---------------------- |
| `attach_license_terms` |

Parameters:

* `ip_id`: The address of the IP to which the license terms are attached.
* `license_template`: The address of the license template.
* `license_terms_id`: The ID of the license terms.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.License.attach_license_terms(
    ip_id="0x4c1f8c1035a8cE379dd4ed666758Fb29696CF721",
    license_template="0x2E896b0b2Fdb7457499B56AAaA4AE55BCB4Cd316", # insert PILicenseTemplate from https://docs.story.foundation/docs/deployed-smart-contracts
    license_terms_id="1"
  )
  ```

  ```python Request Parameters theme={null}
  ip_id: str  # The address of the IP to which the license terms are attached
  license_template: str  # The address of the license template
  license_terms_id: int  # The ID of the license terms
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str
  }
  ```
</CodeGroup>

### mint\_license\_tokens

Mints license tokens for the license terms attached to an IP.

The license tokens are minted to the receiver.

The license terms must be attached to the IP before calling this function.

IP owners can mint license tokens for their IPs for arbitrary license terms without attaching the license terms to IP.

It might require the caller pay the minting fee, depending on the license terms or configured by the iP owner. The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner. IP owners can configure the minting fee of their IPs or configure the minting fee module to determine the minting fee.

| Method                |
| --------------------- |
| `mint_license_tokens` |

Parameters:

* `licensor_ip_id`: The licensor IP ID.
* `license_template`: The address of the license template.
* `license_terms_id`: The ID of the license terms within the license template.
* `amount`: The amount of license tokens to mint.
* `receiver`: The address of the receiver.
* `max_minting_fee`: \[Optional] The maximum minting fee to pay.
* `max_revenue_share`: \[Optional] The maximum revenue share percentage.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = client.License.mint_license_tokens(
    licensor_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    license_template="0x2E896b0b2Fdb7457499B56AAaA4AE55BCB4Cd316", # insert PILicenseTemplate from https://docs.story.foundation/docs/deployed-smart-contracts
    license_terms_id="1",
    amount=1,
    receiver="0x14dC79964da2C08b23698B3D3cc7Ca32193d9955", # optional
    max_minting_fee=0, # disabled
    max_revenue_share=100 # default
  )
  ```

  ```python Request Parameters theme={null}
  licensor_ip_id: str  # The licensor IP ID
  license_template: str  # The address of the license template
  license_terms_id: int  # The ID of the license terms
  amount: int   # The amount of license tokens to mint
  receiver: str  # The address of the receiver
  max_minting_fee: int = 0  # Optional: The maximum minting fee to pay
  max_revenue_share: int = 0  # Optional: The maximum revenue share percentage
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "license_token_ids": list,  # List of license token IDs
    "tx_hash": str,  # The transaction hash
  }
  ```
</CodeGroup>

### register\_pil\_terms

Registers new license terms and return the ID of the newly registered license terms.

| Method               |
| -------------------- |
| `register_pil_terms` |

Parameters:

* See the Python code example below for all the parameters. They all come from the [PIL Terms](/concepts/programmable-ip-license/pil-terms).
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.License.register_pil_terms(
    transferable=False,
    royalty_policy="0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", # RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
    default_minting_fee=0,
    expiration=0,
    commercial_use=False,
    commercial_attribution=False,
    commercializer_checker="0x0000000000000000000000000000000000000000",
    commercializer_checker_data="0x",
    commercial_rev_share=10, # 10%
    commercial_rev_ceiling=0,
    derivatives_allowed=True,
    derivatives_attribution=False,
    derivatives_approval=False,
    derivatives_reciprocal=False,
    derivative_rev_ceiling=0,
    currency="0x1514000000000000000000000000000000000000", # $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
    uri="",
  )
  ```

  ```python Request Parameters theme={null}
  transferable: bool  # Indicates whether the license is transferable or not
  royalty_policy: str  # The address of the royalty policy contract
  default_minting_fee: int  # The default minting fee to be paid when minting a license
  expiration: int  # The expiration period of the license
  commercial_use: bool  # Indicates whether the work can be used commercially or not
  commercial_attribution: bool  # Whether attribution is required when reproducing the work commercially
  commercializer_checker: str  # Commercializers that are allowed to commercially exploit the work
  commercializer_checker_data: str  # The data to be passed to the commercializer checker contract
  commercial_rev_share: int  # Percentage of revenue that must be shared with the licensor (0-100)
  commercial_rev_ceiling: int  # The maximum revenue that can be generated from commercial use
  derivatives_allowed: bool  # Indicates whether the licensee can create derivatives of the work
  derivatives_attribution: bool  # Whether attribution is required for derivatives of the work
  derivatives_approval: bool  # Whether the licensor must approve derivatives before they can be linked
  derivatives_reciprocal: bool  # Whether derivatives must be licensed under the same terms
  derivative_rev_ceiling: int  # The maximum revenue that can be generated from derivative use
  currency: str  # The ERC20 token to be used to pay the minting fee
  uri: str  # The URI of the license terms
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "license_terms_id": int,
    "tx_hash": str
  }
  ```
</CodeGroup>

### register\_non\_com\_social\_remixing\_pil

Convenient function to register a PIL non commercial social remix license to the registry.

<Warning>
  No reason to call this function. Non-Commercial Social Remixing terms are already registered with `licenseTermdId = 1` in our protocol. There's no reason to register them again.
</Warning>

| Method                                 |
| -------------------------------------- |
| `register_non_com_social_remixing_pil` |

Parameters:

* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.License.register_non_com_social_remixing_pil()
  ```

  ```python Request Parameters theme={null}
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "license_terms_id": int,  # The ID of the registered license terms
    "tx_hash": str,  # The transaction hash
  }
  ```
</CodeGroup>

### register\_commercial\_use\_pil

Convenient function to register a PIL commercial use license to the registry.

| Method                        |
| ----------------------------- |
| `register_commercial_use_pil` |

Parameters:

* `default_minting_fee`: The fee to be paid when minting a license.
* `currency`: The ERC20 token to be used to pay the minting fee and the token must be registered on Story's protocol.
* `royalty_policy`: \[Optional] The address of the royalty policy contract, default value is LAP.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.License.register_commercial_use_pil(
    currency='0x1514000000000000000000000000000000000000', # $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
    default_minting_fee=10, # 10 of the currency (using the above currency, 10 $WIP),
    royalty_policy="0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", # RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
  )
  ```

  ```python Request Parameters theme={null}
  default_minting_fee: int  # The fee to be paid when minting a license
  currency: str  # The ERC20 token to be used to pay the minting fee
  royalty_policy: str = None  # Optional: The address of the royalty policy contract
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "license_terms_id": int,  # The ID of the registered license terms
    "tx_hash": str,  # The transaction hash
  }
  ```
</CodeGroup>

### register\_commercial\_remix\_pil

Convenient function to register a PIL commercial Remix license to the registry.

| Method                          |
| ------------------------------- |
| `register_commercial_remix_pil` |

Parameters:

* `default_minting_fee`: The fee to be paid when minting a license.
* `commercial_rev_share`: Percentage of revenue that must be shared with the licensor.
* `currency`: The ERC20 token to be used to pay the minting fee and the token must be registered on Story's protocol.
* `royalty_policy`: The address of the royalty policy contract, default value is LAP.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.License.register_commercial_remix_pil(
    currency='0x1514000000000000000000000000000000000000', # $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
    default_minting_fee=10, # 10 of the currency (using the above currency, 10 $WIP)
    royalty_policy="0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", # RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
    commercial_rev_share=10 # 10%
  )
  ```

  ```python Request Parameters theme={null}
  default_minting_fee: int  # The fee to be paid when minting a license
  currency: str  # The ERC20 token to be used to pay the minting fee
  commercial_rev_share: int  # Percentage of revenue that must be shared with the licensor
  royalty_policy: str  # The address of the royalty policy contract
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "license_terms_id": int,  # The ID of the registered license terms
    "tx_hash": str,  # The transaction hash
  }
  ```
</CodeGroup>
