# Code Licensing and Royalties

The Flex IP Commons enables flexible and enforceable licensing of code assets through the use of smart contracts and programmable royalties. Developers can specify the licensing terms and conditions for their code NFTs, such as permissions, limitations, and pricing models, using standardized or custom license templates.

The licensing terms are encoded in the code NFT metadata and enforced by the IP Commons' smart contracts, which automatically grant or revoke access to the code based on the purchaser's compliance with the terms. The smart contracts also handle the distribution of royalties and fees to the code creators and other stakeholders, based on predefined revenue-sharing models.

{% hint style="info" %}
The IP Commons supports various licensing models, such as one-time purchases, subscriptions, revenue-sharing, and pay-per-use, through the use of different token types and transfer mechanisms. For example, a subscription-based code NFT may require the purchaser to hold a certain amount of FLEXE tokens in their wallet to maintain access, while a pay-per-use code NFT may charge a micro-transaction for each function call or API request.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flexecosystem.gitbook.io/flex-docs/protocol/flex-commons/code-licensing-and-royalties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
