> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/api/membership.md).

# Membership

CodeMash **Membership** service provides many operations for user management like user authentication and authorization.

Membership service is enabled automatically when you create a project. This means you can start using membership services and API methods right after you create a project.

Features included in membership service:

1. Users - users of your application.
2. Authentication and authorization - managing user session and permissions.

## Using SDK

If you decide to use one of our provided SDK, the following code shows how to initialize membership service.

{% tabs %}
{% tab title=".NET" %}

```csharp
var projectId = Guid.Parse("{YOUR_PROJECT_ID}");
var apiKey = "{YOUR_SECRET_KEY}";

var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}
{% endtabs %}

## Example

The following are examples of membership SDK using different languages and frameworks.

{% tabs %}
{% tab title=".NET" %}

```csharp
using System;
using CodeMash.Client;
using CodeMash.Membership.Services;
using Isidos.CodeMash.ServiceContracts;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            // 1. Get your Project ID and Secret Key
            var projectId = Guid.Parse("{YOUR_PROJECT_ID}");
            var apiKey = "{YOUR_SECRET_KEY}";

            // 2. Create a general client for API calls
            var client = new CodeMashClient(apiKey, projectId);
            
            // 3. Create a service object
            var membershipService = new CodeMashMembershipService(client);

            // 4. Call an API method
            membershipService.RegisterUser(new RegisterUserRequest
            {
                Email = "test@email.com",
                Password = "password123"
            });
        }
    }
}
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.codemash.io/api/membership.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
