# Authefy GraphQL API

## Schema

{% file src="/files/-Mb9LOWQfYE8jWu3ZuAl" %}
authefy.graphql
{% endfile %}

## Internal API Flow

#### Admin registers in Authefy GraphQL API with their email

```graphql
mutation {
  createAdmin(input:{
    username:"hov@email.com"
    password:"8b7b748af874504b98d263e8d070fec3"
  }) {
    id
    username
    type
    isEmailVerified
  }
}
```

#### Admin verifies their email

![Click the link and it will verify the admin's email](/files/-Mb9FuMuyyxkRlDjg_eP)

#### Admin creates a new application

```graphql
mutation {
  createApplication(input:{
    name:"Demo Application" #name of application
    domainName:"https://demo-app.ph" #(optional) home url of the application
    webhookURI: "https://demo-app.ph/hook" #(optional) router where Authefy will send user events 
    requireEmailVerification: true #(optional) send email verification to application users after regisration
    redirectionURIAfterEmailVerification: "https://demo-app.ph/home" #(optional) landing page where the user will be redirected after verifying their email
    usernameFormat: EMAIL #(optional) force users to use formatted usernames. by default, user can register any string as username
  }) {
    id
    name
    domainName
    webhookURI
    accessKeys
    usernameFormat
    requireEmailVerification
    redirectionURIAfterEmailVerification
  }
}
```

#### Admin generates a new application access key

```graphql
mutation {
  generateApplicationAccessKey(id: "application-id")
  # returns an access-key
}
```


---

# 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://iammeosjin.gitbook.io/authefy/master.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.
